优山美地升级后破碎的Apache虚拟主机 [英] Broken Apache Virtual Hosts after Yosemite upgrade
问题描述
我最近升级到Mac OS X Yosemite和我为我的虚拟主机Apache的配置不工作。我升级了PHP @raoulsson的建议(<一个href=\"http://superuser.com/questions/827937/apache-problems-after-upgrading-to-yosemite\">http://superuser.com/questions/827937/apache-problems-after-upgrading-to-yosemite ):
I recently upgraded to MAC OS X Yosemite and my apache configuration for my virtual hosts is not working. I upgraded php as suggested by @raoulsson ( http://superuser.com/questions/827937/apache-problems-after-upgrading-to-yosemite ):
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
和还编辑/etc/apache2/extra/httpd-vhosts.conf:
And also edited /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 )给我的消息的 这作品,而不是显示我的网站。任何人对我失去了我的想法?
Now navigating to one of my virtual hosts (http://test.local) gives me the message "It Works" instead of showing my website. Anyone with an idea on what I'm missing?
编辑:
因此,原来的问题是在/etc/apache2/httpd.conf。我只好以重新启用虚拟主机为它工作。而且,由于我使用重写上面的虚拟主机,我也只好加载重写引擎。
So it turns out that the issue was in /etc/apache2/httpd.conf. I had to re-enable virtual hosts in order for it to work. And since I'm using rewrites in the above virtual host, I also had to load the rewrite engine.
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必要的,但我的配置是现在的工作,所以我会留在这。
Not sure if the alias_module is necessary, but my configuration is now working, so I'll leave it at that.
推荐答案
,你需要删除#在一些线路。 espacially的vhost.conf文件默认情况下不导入。
at first, you need to remove the "#" in some lines. espacially the vhost.conf file is not imported by default.
这样的:
#LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
#Include /private/etc/apache2/extra/httpd-vhosts.conf
到
LoadModule php5_module libexec/apache2/libphp5.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
Include /private/etc/apache2/extra/httpd-vhosts.conf
和添加一些#在别人
<Directory />
AllowOverride none
Require all denied
</Directory>
到
<Directory />
#AllowOverride none
#Require all denied
</Directory>
根据 http://mallinson.ca/osx-web-development/
这篇关于优山美地升级后破碎的Apache虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!