我最近升级到MAC OS X Yosemite,并且我的虚拟主机的apache配置无法正常工作。我升级的PHP通过@raoulsson(https://superuser.com/questions/827937/apache-problems-after-upgrading-to-yosemite)的建议:优胜美地升级后损坏的Apache虚拟主机
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
而且还编辑/etc/apache2/extra/httpd-vhosts.conf:
<VirtualHost *:80>
ServerName test.local
DocumentRoot "/Users/my-name/www/test"
<Directory "/Users/my-name/www/test>
AllowOverride All
#Order allow,deny
#Allow from all
Require all granted
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule^- [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule^index.html [L]
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Order deny,allow
Deny from all
</Files>
</VirtualHost>
现在导航到我的虚拟主机之一(http://test.local)给我的信息“It Works”而不是显示我的网站。任何人有想到我失踪的想法?
编辑: 所以事实证明,问题是在/etc/apache2/httpd.conf。我必须重新启用虚拟主机才能使其工作。由于我在上面的虚拟主机中使用重写,我还必须加载重写引擎。
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
不知道是否需要alias_module,但我的配置现在正在工作,所以我会放在那。
谢谢,你刚刚救了我一个小时的faffing :) – phil 2015-04-03 02:23:15