MAC OS山狮 - 阿帕奇运行,但本地主机不工作 [英] Mac OS Mountain Lion - Apache running but localhost not working

查看:256
本文介绍了MAC OS山狮 - 阿帕奇运行,但本地主机不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我装的Apache Web服务器在Mac OS山狮与命令

I loaded Apache Web server on Mac OS Mountain Lion with the command

sudo apachectl start

然而,当我尝试在Firefox中打开本地主机,我得到的消息

However, when I try to open localhost in Firefox, I get the message

未找到:请求的URL /没有被此服务器上找到。阿帕奇/ 2.2.21(Unix的)DAV在本地主机端口80/2服务器

Not Found: The requested URL / was not found on this server. Apache/2.2.21 (Unix) DAV/2 Server at localhost Port 80

我编辑httpd.conf文件都和httpd.conf.default改变

I edited both httpd.conf and httpd.conf.default to change

#ServerName www.website.com

ServerName localhost

它仍然无法正常工作。有什么建议?

It still doesn't work. Any suggestions?

推荐答案

您应该检查指定为你的httpd.conf文件的的DocumentRoot的文件夹的权限,并允许Apache用户至少读访问(应由_www默认情况下)。结果
否则,你可以在DocumentRoot文件文件夹中做一个命令行chmod 755。结果
顺便说一句,你应该只修改的httpd.conf文件,因为httpd.conf.default是,如果你想恢复原来的Apache配置,通过简单地覆盖的httpd,你可以使用默认配置。 CONF文件,用httpd.conf.default文件。结果
我想你还没有启用基于域名的虚拟主机,因为当你启用基于域名的虚拟主机,在主配置文件根目录将被忽略;相反,对于主机名匹配的根将被使用,如果没有与之相匹配的将默认为第一个虚拟主机。结果
最后,当你有问题,要检查的第一件事始终是Apache的错误日志文件。结果
在错误日志的位置,可以通过查看Apache的配置文件中的错误日志指令被发现。

You should check the permissions on the folder specified as the "DocumentRoot" in your "httpd.conf", and allow at least read access for the Apache user (which should by "_www" by default).
Otherwise you could do a "sudo chmod 755" on the "DocumentRoot" folder.
By the way, you should only modify the "httpd.conf" file, since the "httpd.conf.default" is a default configuration that you can use if you want to restore the Apache original configuration, by simply overwriting the "httpd.conf" file with the "httpd.conf.default" file.
I suppose that you've not enabled name-based virtual hosts, since when you enable name-based virtual hosts, the document root in the main config is ignored; instead, the root for the matching hostname will be used, and if none match it will default to the first virtual host.
Finally, when you have problems, the first thing to check is always the Apache error log file.
The location of the the error log can be found by looking at the "ErrorLog" directive in the Apache configuration file.

这篇关于MAC OS山狮 - 阿帕奇运行,但本地主机不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆