
测试环境:
Windows xp
XAMPP for windows
配置步骤:
第一步:找到apache的配置文件httpd.conf(文件在conf目录下)
第二步:让服务器支持mod_rewrite
打开httpd.conf,找到#LoadModule rewrite_module modules/mod_rewrite.so把#去掉
找到<Directory />下AllowOverride None 改成 AllowOverride All
对于不同的网址,需要在APACHE中增加如下内容
<Directory “D:/xampp/htdocs/test”>
AllowOverride All
</Directory>
第三步:重启apache服务器。
第四步:在需要URL重写的网站目录下放一个.htaccess文件......

gzip可以极大的加速网站。关于gzip的具体介绍可参看:gzip-百度百科 。
下面只介绍在WAMP环境下如何开启apache的gzip。
方法如下:
1. httpd.conf中打开deflate_Module和headers_Module模块
2. httpd.conf中添加:
<IfModule deflate_module>
SetOutputFilter DEFLATE
# Don’t compress images and other
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .(?:pdf|doc)......

外网访问XAMPP出现如下错误:
New XAMPP security concept:
Access to the requested directory is only available from the local network.
This setting can be configured in the file “httpd-xampp.conf”.
解决办法:
打开httpd-xampp.conf(/xampp/apache/conf/extra/httpd-xampp.conf)
找到以下内容
<LocationMatch “^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))”>
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.......

可能的情况1:端口被占用
运行cmd -> netstat -ano, 查看端口是否被占用,若被占用将占用端口的程序关闭。
或修改xampp中apache的默认端口:
打开xampp\apache\conf\httpd.conf文件把80修改为8081;
附修改SSL端口:
打开xampp\apache\conf\extra\httpd-ssl.conf文件把443修改为4433或者关闭SSL扩展
可能的情况2:缺少Microsoft Visual C++ 2008 Runtime组件
系统缺少Microsoft Visual C++ 2008 Runtime这个组件,安装Microsoft Visual C++ 2008 Redistributable Package即可解决。
下载地址:http://www.microsoft.com/downloa......

错误:HTTP 错误 403 – 禁止访问
即403 Forbidden:You don’t have permission to access / on this server.
打开apache的配置文件httpd.conf,找到以下这段代码:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
将“Deny from all”已经拒绝了一切连接改成“allow from all”。
修改后的代码如下:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all
</Directory>
参考:http://www.cnblogs.co......
作者: owoer
|
发表于:2012年7月17日
|
栏目:Apache, Web服务
|
You don’t have permission to access / on this server.(Apache下403 Forbidden错误)已关闭评论
阅读全文