web 服务403错误小结

200 - OK,服务器成功返回网页

    - Standard response for successful HTTPrequests.

301 - MovedPermanently(永久跳转),请求的网页已永久跳转到新位置。

    - This and all future requests should bedirected to the given.

403 - Forbidden(禁止访问),服务器拒绝请求

    - forbiddenrequest (matches a deny filter) => HTTP 403

    - The requestwas a legal request, but the server is refusing to respond to it.

404 - Not Found,服务器找不到请求的页面。

    - The requested resource could not be foundbut may be available again in the future.

500 - InternalServer Error(内部服务器错误)

    - internal error in haproxy => HTTP 500

    - A generic error message, given when nomore specific message is suitable.

502 - Bad Gateway(坏的网关),一般是网关服务器请求后端服务时,后端服务没有按照http协议正确返回结果。

    - the server returned an invalid orincomplete response => HTTP 502

    - The server was acting as a gateway orproxy and received an invalid response from the upstream server.

503 - ServiceUnavailable(服务当前不可用),可能因为超载或停机维护。

    - no server was available to handle therequest => HTTP 503

    - The server is currently unavailable(because it is overloaded or down for maintenance).

504 - GatewayTimeout(网关超时),一般是网关服务器请求后端服务时,后端服务没有在特定的时间内完成服务。

    - the server failed to reply in time =>HTTP 504

- The server was acting as a gateway or proxy and didnot receive a timely response from the upstream server.


原因1

Apache的配置文件中没有对站点目录的权限许可配置,这通常是在初始化安装apache后,更改了默认的apache站点目录所致;

<Directory "/application/apache2.2.26/htdocs">

    Options Indexes FollowSymLinks

AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

 

<Directory"/var/blog/">

   Options FollowSymLinks

AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

 

这个可以在httpd-vhosts.conf中配置,主配置文件就是全局的配置;


原因2

站点目录下没有首页文件(index文件),而apache的配置又禁止了目录浏览,就会提示403错误;

也就是把Options IndexesFollowSymLinks中有的Indexes文件;然后站点目录下又没有index.html文件;就会把站点目录下的目录结果都在浏览器上显示;如果把索引禁掉Indexes,则就会报403错误;


原因三:还是Directory权限问题:

<Directory "/application/apache2.2.26/htdocs">

    Options Indexes FollowSymLinks

AllowOverride None

    Order allow,deny

    Allow from all

    Allow from 10.0.0.0/24

    deny from 192.168.0.0/24

</Directory>


原因四:站点目录权限问题;

站点目录需要有apache的用户有访问权限,否则就会报403错误;

[root@modeconf]#ll /var/blog/

total 6968

-rw-r--r--  1 ettett   54724 Jun 12  2011 expires.jpg

-rw-r--r--  1 ettett   54724 Jun 12  2011 expires.jpg.1

-rw-r--r--  1 ettett      49 Dec 12 23:01 index.html

-rw-r--r--  1 ettett     418 Sep 25 08:18 index.php

-rw-r--r--  1 ettett   19929 Jan 18  2013 license.txt

-rw-r--r--  1 ettett    6586 Dec 13 15:26 readme.html

-rw-r--r--  1 ettett     316 Dec 20 18:30 test_mysql.php

drwxr-xr-x  2 ettett    4096 Dec 20 18:53 wordpress

[root@modeconf]#egrep "User|Group" httpd.conf

# User/Group: Thename (or #number) of the user/group to run httpd as.

User ett

Group ett

LogFormat "%h%l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\"" combined

LogFormat "%h%l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\" %I %O" combinedio

# User homedirectories

[root@modeconf]#pwd

/application/apache/conf


本文出自 “Try to be brave” 博客,谢绝转载!

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。