11lxm 发表于 2018-11-11 13:45:32

Nginx+Apache有效提高服务器负载能力

  #配置apache配置参数文件httpd.conf,位于/usr/local/apache/conf/目录。
  # cd /usr/local/apache/conf/
  # mv httpd.conf httpd.conf.bak
  # vim httpd.conf
  #写入以下内容ip、主机名、邮箱按照自己实际修改即可。
  PidFile logs/httpd.pid
  LockFile logs/accept.lock
  ServerRoot "/usr/local/apache"
  Listen 0.0.0.0:81
  User nobody
  Group nobody
  ServerAdmin aaa@gmail.com
  ServerName hosts.whypc.info
  Timeout 300
  KeepAlive Off
  MaxKeepAliveRequests 100
  KeepAliveTimeout 5
  UseCanonicalName Off
  AccessFileName .htaccess
  TraceEnable Off
  ServerTokens ProductOnly
  FileETag None
  ServerSignature Off
  HostnameLookups Off
  # LoadModule perl_module modules/mod_perl.so
  LoadModule suphp_module modules/mod_suphp.so
  #suPHP_Engine on
  #AddType application/x-httpd-php .php
  LoadModule rpaf_module modules/mod_rpaf-2.0.so
  #Mod_rpaf settings
  RPAFenable On
  RPAFproxy_ips 127.0.0.1 204.74.291.132
  RPAFsethostname On
  RPAFheader X-Forwarded-For
  DocumentRoot "/usr/local/apache/htdocs"
  
  Options ExecCGI FollowSymLinks Includes IncludesNOEXEC -Indexes -MultiViews SymLinksIfOwnerMatch
  Order allow,deny
  Allow from all
  AllowOverride All
  
  
  Options Includes -Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
  
  DefaultType text/plain
  RewriteEngine on
  AddType text/html .shtml
  #AddHandler cgi-script .cgi .pl .plx .ppl .perl
  AddHandler server-parsed .shtml
  
  TypesConfig conf/mime.types
  AddType application/perl .pl .plx .ppl .perl
  AddType application/x-img .img
  AddType application/cgi .cgi
  AddType text/x-sql .sql
  AddType text/x-log .log
  AddType text/x-config .cnf conf
  AddType text/x-registry .reg
  AddType application/x-compress .Z
  AddType application/x-gzip .gz .tgz
  AddType text/html .shtml
  AddType application/x-tar .tgz
  AddType application/rar .rar
  AddType application/x-compressed .rar
  AddType application/x-rar .rar
  AddType application/x-rar-compressed .rar
  AddType text/vnd.wap.wml .wml
  AddType image/vnd.wap.wbmp .wbmp
  AddType text/vnd.wap.wmlscript .wmls
  AddType application/vnd.wap.wmlc .wmlc
  AddType application/vnd.wap.wmlscriptc .wmlsc
  
  
  DirectoryIndex index.html index.htm index.shtml index.php
  
  
  Order allow,deny
  Deny from all
  Satisfy All
  
  
  Order allow,deny
  Deny from all
  Satisfy All
  
  ErrorLog "logs/error_log"
  LogLevel warn
  
  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  LogFormat "%h %l %u %t \"%r\" %>s %b" common
  
  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  
  CustomLog "logs/access_log" common
  
  
  ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
  
  
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
  
  
  StartServers          3
  MinSpareServers       3
  MaxSpareServers       5
  MaxClients          150
  MaxRequestsPerChild   1024
  
  
  
  Header set Cache-Control "max-age=3600, must-revalidate"
  
  
  ReadmeName README.html
  HeaderName HEADER.html
  IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
  Include conf/extra/httpd-languages.conf
  
  SetHandler server-status
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
  
  ExtendedStatus On
  
  SetHandler server-info
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
  
  
  Listen 0.0.0.0:443
  AddType application/x-x509-ca-cert .crt
  AddType application/x-pkcs7-crl .crl
  SSLCipherSuite ALL:!ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
  SSLPassPhraseDialogbuiltin
  SSLSessionCache         dbm:/usr/local/apache/logs/ssl_scache
  SSLSessionCacheTimeout300
  SSLMutexfile:/usr/local/apache/logs/ssl_mutex
  SSLRandomSeed startup builtin
  SSLRandomSeed connect builtin
  
  #Vhosts
  NameVirtualHost 204.74.291.132:81
  NameVirtualHost *
  
  ServerName hosts.whypc.info
  DocumentRoot /var/www/html
  ServerAdmin aaa@gmail.com
  
  Include conf/vhosts/*

页: [1]
查看完整版本: Nginx+Apache有效提高服务器负载能力