【发布时间】:2015-01-19 09:48:27
【问题描述】:
我最近升级到 MAC OS X Yosemite,但我的虚拟主机的 apache 配置无法正常工作。我按照@raoulsson (https://superuser.com/questions/827937/apache-problems-after-upgrading-to-yosemite) 的建议升级了 php:
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) 会给我消息“它可以工作”,而不是显示我的网站。有人知道我缺少什么吗?
编辑: 所以事实证明问题出在 /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 是否必要,但我的配置现在可以正常工作,所以我将保留它。
【问题讨论】:
标签: php apache osx-yosemite