问题描述
昨天我升级到优胜美地,现在我的web开发本地配置不工作了。
Yesterday I upgraded to Yosemite and now my local configuration for web development is not working anymore.
我设法下设 A USERDIR /用户/用户/的public_html
,我可以通过本地主机/〜用户/ websitename访问所有网站
。没什么特别的,但我花了一段时间来配置。
I managed to set up a userdir under /Users/user/public_html
and I could access all the websites via localhost/~user/websitename
. Nothing special, but it took me a while to configure.
展望我看到很多文件被替换,保持备份Apache目录。我试图再次放回文件与我的设置,但仍不能正常工作。也许我缺少的,我不记得某些文件。
Looking in the apache directory I saw that many files were replaced, keeping a backup. I tried putting back the files with my settings again, but still is not working. Maybe I'm missing some file that I don't remember.
这是的httpd-userdir.conf:
This is httpd-userdir.conf:
# Settings for user home directories
#
# Required module: mod_userdir
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir public_html
#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
RegisterUserSite customized-users
</IfModule>
<Directory "/Users/*/public_html/">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
</Directory>
然后在我的http.conf启用一些模块:
Then in http.conf I have enabled some modules:
Include /private/etc/apache2/extra/httpd-userdir.conf
LoadModule userdir_module libexec/apache2/mod_userdir.so
和这样的:
的DocumentRoot/用户/用户/的public_html
DocumentRoot "/Users/user/public_html"
Directory "/Users/user/public_html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
如果我只是试图访问本地主机
,它显示消息它的工作!如果我去本地主机/用户
简单,如果我尝试访问的网站之一不加载和相同的。
If I simply try to access localhost
, it displays the message "It works!". If I go to localhost/user
simply doesn't load and the same if I try to access one of the websites.
我错过任何文件?在Apache日志它甚至不显示任何错误。
Did I miss any file? In the apache logs it doesn't even display any error.
推荐答案
OS X 10.10约塞米蒂自带的Apache 2.4,而不是2.2的Apache在小牛队。结果
在配置的主要区别是,你必须更换...
OS X 10.10 Yosemite comes with Apache 2.4 instead of Apache 2.2 in Mavericks.
The major difference in configuration is that you have to replace...
Order allow,deny
Allow from all
... ...用
...with...
Require all granted
从2.2 见Apache的文档手册升级到2.4的更多细节。
See Apache doc's manual Upgrading to 2.4 from 2.2 for more details.
更新:结果
请注意,升级OS X后,你通常会发现你的旧的配置文件进行备份,通过约塞米蒂写入新的旁边。它们例如标记的 httpd.conf文件。pre-更新的和/或的httpd.conf〜previous 的,并且可以在新的CONFIGS相同的路径中找到(如的 /私人的/ etc / Apache2的的)。
UPDATE:
Please be aware that after upgrading OS X you will usually find your old config files as backups next to the new ones written by Yosemite. They are labeled e.g. httpd.conf.pre-update and/or httpd.conf~previous and can be found in the same paths as the new configs (e.g. in /private/etc/apache2).
这篇关于升级到优胜美地后破碎的Apache配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!