Php Yosemite升级后Apache虚拟主机损坏
我最近升级到MAC OS X Yosemite,我的虚拟主机apache配置不起作用。我按照@raoulsson()的建议升级了php: 还编辑了/etc/apache2/extra/httpd-vhosts.conf:Php Yosemite升级后Apache虚拟主机损坏,php,apache,osx-yosemite,Php,Apache,Osx Yosemite,我最近升级到MAC OS X Yosemite,我的虚拟主机apache配置不起作用。我按照@raoulsson()的建议升级了php: 还编辑了/etc/apache2/extra/httpd-vhosts.conf: <VirtualHost *:80> ServerName test.local DocumentRoot "/Users/my-name/www/test" <Directory "/Users/my-name/www/test> A
<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>
不确定是否需要alias_模块,但我的配置现在正在运行,因此我将保留它。OS X 10.10 Yosemite随附Apache 2.4,而不是Mavericks中的Apache 2.2。
配置上的主要区别是您必须替换
Order allow,deny
Allow from all
…与
Require all granted
有关更多详细信息,请参阅ApacheDoc手册
更新:请注意,升级OS X后,您通常会在Yosemite编写的新配置文件旁边找到旧配置文件作为备份。它们被标记为httpd.conf.pre-update和/或httpd.conf~previous,可以在与新配置相同的路径中找到(例如/private/etc/apache2)。首先,您需要删除某些行中的“#”。特别是vhost.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>
不允许超限
要求全部拒绝
到
#不允许超限
#要求全部拒绝
根据谢谢,你刚刚为我节省了一个小时的闲聊时间:)谢谢你关于预更新的通知,我不知道:)
#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>