當前位置:首頁 » 密碼管理 » 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等錯誤。

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:594
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:889
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:583
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:766
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:685
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1014
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:257
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:116
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:808
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:714