當前位置:首頁 » 密碼管理 » apache拒絕訪問文件

apache拒絕訪問文件

發布時間: 2023-01-07 22:57:45

A. 403拒絕訪問解決辦法有哪些

解決403 forbidden錯誤的方法:

1、重建dns緩存

對於一些常規的403 forbidden錯誤,馬海祥建議大家首先要嘗試的就是重建dns緩存,在運行中輸入cmd,然後輸入ipconfig /flushdns即可。如果不行的話,就需要在hosts文件里把主頁解析一下了。

同時,查看是否在網站虛擬目錄中添加默認文檔,一般默認文檔為:index.html;index.asp;index.php;index.jsp;default.htm;default.asp等。

2、修改文件夾安全屬性

用以下命令修改文件夾安全屬性

chcon -R -t httpd_user_content_t public_html/

所用命令解析:

ls -Z -d public_html/#顯示文件/目錄的安全語境-Z, --context Display security context so it fits on most displays. Displays only mode, user, group, security context and file name.-d, --directory list directory entries instead of contents, and do not dereference symbolic links chcon -R -t httpd_user_content_t public_html/#修改文件/目錄的安全語境-R, --recursive change files and directories recursively-t, --type set type TYPE in the target security context

3、關於apache導致的403 forbidden錯誤的解決辦法

打開apache的配置文件httpd.conf,找到這段代碼:

Options FollowSymLinks AllowOverride None Order deny,allow Deny from all

有時候由於配置了php後,這里的「Deny from all」已經拒絕了一切連接。把該行改成「allow from all」,修改後的代碼如下,問題解決。

Options FollowSymLinks AllowOverride None Order deny,allow Allow from all

之所以會出現錯誤,是因為大多數的國外主機在配置Apache的時候啟用了mod_security,也就是開啟了安全檢查,如果提交的信息中包含select , % , bin等關鍵字,Apache就會禁止,並給出403,404,500等錯誤。

熱點內容
shell腳本main函數 發布:2025-08-21 08:38:27 瀏覽:785
eclipse配置android 發布:2025-08-21 08:36:37 瀏覽:28
qq緩存文件夾在哪裡 發布:2025-08-21 08:31:14 瀏覽:615
python數組中文 發布:2025-08-21 08:29:42 瀏覽:764
掛號源碼 發布:2025-08-21 08:17:06 瀏覽:184
ip如何登錄伺服器 發布:2025-08-21 08:17:03 瀏覽:985
小的壓縮機 發布:2025-08-21 08:11:48 瀏覽:125
精易助手源碼 發布:2025-08-21 08:10:24 瀏覽:842
mysql更新存儲過程 發布:2025-08-21 08:04:52 瀏覽:221
資料庫抓取 發布:2025-08-21 07:31:04 瀏覽:333