Apache配置日记


因为需要本地调试代码,对于Apache2.2的httpd.conf和php.ini配置进行了一些折腾。
.
.
.
实现多端口绑定目录
目标是
1.http://localhost:8081绑定到D:/Users/Rexdf/php/Web/
2.http://blog.localhost.com:8082绑定到D:/Users/Rexdf/php/Web/blog
首先是httpd.conf配置
Listen 8081
Listen 8082
开启端口侦听,不然apache都无法启动
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include conf/extra/httpd-vhosts.conf
开启虚拟主机支持,配置文件httpd-vhosts.conf
然后就是httpd-vhosts.conf配置

 ServerAdmin rexdf@blog.localhost
DocumentRoot "D:/Users/Rexdf/php/Web/blog"
ServerName blog.localhost.com
ErrorLog "logs/dummy-host4.localhost-error.log"
CustomLog "logs/dummy-host4.localhost-access.log" common

ServerAdmin rexdf@blog.localhost
DocumentRoot "D:/Users/Rexdf/php/Web/"
ServerName localhost
ErrorLog "logs/dummy-host4.localhost-error.log"
CustomLog "logs/dummy-host4.localhost-access.log" common

这样就可以启动了,不过出现了一个插曲。http://blog.localhost.com:8082可以正常访问,但是http://localhost:8081却总是异常,查logs/dummy-host4.localhost-error.log可以看到

[Sat Jun 16 21:21:46 2012] [alert] [client 127.0.0.1] D:/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Sat Jun 16 21:21:49 2012] [alert] [client 127.0.0.1] D:/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
[Sat Jun 16 21:21:50 2012] [alert] [client 127.0.0.1] D:/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

明显的错误嘛,网站过多,我却习惯用D:/作为临时目录使用。这说明apache是会逐个目录检查.htacess文件的。一旦检查到就会解析,当然这是因为我开启了rewrite_module的缘故。



本文链接:Apache配置日记

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源:Rexdf,谢谢!^^


此条目发表在网站建设分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*

:zsmilebig: :zsadbig: :zwiredbig: :zgreenhappy: more »

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据