web 服務403錯誤小結

來源:互聯網
上載者:User

標籤:web

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錯誤;

[[email protected]]#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

[[email protected]]#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

[[email protected]]#pwd

/application/apache/conf


本文出自 “Try to be brave” 部落格,謝絕轉載!

web 服務403錯誤小結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.