yiwi 发表于 2015-8-2 07:42:10

xampp-apache配置

  我安装的软件是xampp-win32-1.8.2-0-VC9-installer
  需要配置的文件有
  httpd.conf
  httpd-default.conf
  httpd-info.conf
  httpd-xampp.conf
  xampp安装后,以下文件夹内的内容需要配置修改
  xamp\apache\bin
  xamp\apache\conf
  xamp\apache\conf\extra
  xamp\apache\modules
  ---以下是我自己遇到的问题
  ---windows server 2008的系统
  1.安装后启动不了,总提示libsasl.dll缺失
  解决方法:将xampp/php/libsasl.dll文件复制到xampp\apache\bin文件下
  2.apache中设置端口 (xampp\apache\conf\httpd.conf)
  默认是80端口,可以修改,如下,
  #Listen 12.34.56.78:80 
  #Listen 80
  Listen 8081  
  这样设置后,本地启动网址为http://localhost:8081/
  如果需要多个端口可以再添加
  例如:
  Listen 8082  
  NameVirtualHost *:8082
  
  ServerName localhost:8082
  DocumentRoot "D:/xampp/htdocs/projectname"
  
  其中servername和documentroot要根据实际情况改变
  如IP为10.1.12.3 则 ServerName 10.1.12.3:8082
  DocumentRoot 则是你程序的位置
  3.网站启动后可能会存在slow http post、slowloris的安全性问题(xampp\apache\conf\httpd.conf)  
  解决slow http post的方法
  解决方法:LoadModule reqtimeout_module modules/mod_reqtimeout.so前的'#'去掉 并添加如下内容
  //其实以下内容在xampp\apache\conf\extra\httpd-default.conf文件中已设置,保证httpd.conf文件中保证Include "conf/extra/httpd-default.conf"此句话存在且未被注释即可
  
      RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
  
  以下的内容也可能是需要配置的,但是我未验证  
  
     # handle connections from up to 100000 different IPs
     QS_ClientEntries 100000
     # allow only 50 connections per IP
     QS_SrvMaxConnPerIP 50
     # limit maximum number of active TCP connections limited to 256
     MaxClients 256
     # disables keep-alive when 180 (70%) TCP connections are occupied
     QS_SrvMaxConnClose 180
     # minimum request/response speed (deny slow clients blocking the server, keeping connections open without requesting anything
     QS_SrvMinDataRate 150 1200
  
  解决slowloris的方法:
  下载适合你电脑的mod_antiloris.so,我的是x86_2.4_vc10,将mod_antiloris.so放到xampp\apache\modules位置下
  LoadModule antiloris_module modules/mod_antiloris.so
  
      IPReadLimit 50
  
  4.网站启动后,网站会泄露apache,php的版本信息问题(xampp\apache\conf\extra\httpd-default.conf)
  解决方法,将此文件中的ServerTokens,ServerSignature值修改
  #ServerTokens Full
  ServerTokens Prod
  #ServerSignature On
  ServerSignature Off
  5.网站启动后,网站会泄露apache状态信息即server-status、server-info(xampp\apache\conf\extra\httpd-info.conf)
  解决方法:将SetHandler server-status和SetHandler server-info注释掉
  
      #SetHandler server-status
  
  
      #SetHandler server-info
  
  6.关于New XAMPP security concept问题,(xampp中关于登录的一些问题)(xampp\apache\conf\extra\httpd-xampp.conf)
  个人理解:让xampp的登录页面只能本地访问,其他位置都不可以访问xampp、mysql等的登录页面
  
  Order deny,allow
  Deny from all
  #Allow from ::1 127.0.0.0/8 \
  #fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
  #fe80::/10 169.254.0.0/16
  Allow from 127.0.0.1
  ErrorDocument 403 /error#/XAMPP_FORBIDDEN.html.var
  
  7.配置完后,需要重启apache才能生效
  8.xampp安装好后,apache不是系统的服务
  xampp\apache\apache_installservice.bat
  右击此文件以管理员身份运行,apache服务就是出现服务内了,如果没出现,重启电脑应该可以出现
  xampp\apache\apache_uninstallservice.bat
  右击此文件以管理员身份运行,apache服务可以从电脑服务中卸载掉
  9.php简写模式打开
  php中有些代码用简写即编辑的所以php.ini中 
  short_open_tag = On
  10.error_log="D:\tools\xampp\php\logs\php_error_log"
  将php.ini文件中此句话注释掉,防止产生大量的日志文件
  11.extension=php_ldap.dll
  php.ini文件中此句话,表示使用域账号,如果程序不适用域账号,此句话需注释
  
  12.http://boxbaby123.blog.163.com/blog/static/23542244201412610412746/
  此链接中还有一些优化设置
  
  
  
  
  
  
  
页: [1]
查看完整版本: xampp-apache配置