web 关于http://localhost无法访问的可能原因

来源:互联网 发布:xp专业版激活软件 编辑:程序博客网 时间:2024/04/30 07:28

1. /private/var/log/apache2/error_log中错误信息:

[Thu Feb 04 22:30:52.580099 2016] [autoindex:error] [pid 253] [client ::1:49599] AH01276: Cannot serve directory /Library/WebServer/Documents/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

修改方法:

<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>


2.访问localhost只是把index.php的文本显示出来

修改方法:

在httpd.conf中解开注释:LoadModule php5_module libexec/apache2/libphp5.so

在httpd.conf中加入 AddType application/x-httpd-php .php


3.error_log中错误信息:

[Fri Feb 05 08:15:45.658323 2016] [core:alert] [pid 1292] [client ::1:51682] /Library/WebServer/Documents/pinpoint/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

修改方法:

在httpd.conf中解开注释:LoadModule rewrite_module libexec/apache2/mod_rewrite.so



4.Forbidden You don't have permission to access / on this server.

[Fri Feb 05 09:07:17.407615 2016] [core:error] [pid 1940] (13)Permission denied: [client ::1:52605] AH00035: access to / denied (filesystem path '/Users/worldzhy/Documents/InceptionPad') because search permissions are missing on a component of the path

修改方法:不但目的路径的权限要设置为755,目的路径向上追溯的每一级父路径都要设置权限为755.

这篇blog写得很认真 http://blog.163.com/lgh_2002/blog/static/4401752620145110950807/


5.如果有项目本身需要write权限,只要把具体的子路径权限改为777就可以了,下图即为这种情况:


0 0
原创粉丝点击