nginx發布後訪問報403 Forbidden

2021-10-05 21:47:30 字數 852 閱讀 9320

nginx啟動後,訪問報錯:

檢視linux日誌:

cat /user/local/nginx/logs/error.log
發現日誌報錯如下:

2020/05/08 21:26:39 [error] 122404#0: *2 open() "/usr/local/nginx/html/index.html" failed (13: permission denied), client: 10.10.191.3, server: localhost, request: "get / http/1.1", host: "10.100.100.54:6080"
解決方案如下:

一、啟動使用者和nginx工作使用者不一致(我的是這個錯)

ps -ef | grep nginx
檢視nginx的啟動使用者,發現是nobody,而為是用root啟動的

修改nginx.conf,修改user與啟動使用者為一致

二、未指定index.html頁面

需要在配置檔案中配置伺服器首頁

三、伺服器目錄許可權不足

chmod -r 777 /資料夾名稱

nginx顯示目錄報403錯誤

公司乙個windows專案提測,需要搭建乙個用於儲存各個提測版本的nginx頁面,具體配置如下 location download autoindex exact size off 預設為on,顯示出檔案的確切大小,單位是bytes。改為off後,顯示出檔案的大概大小,單位是kb或者mb或者gb a...

nginx 配置後頁面訪問是報500錯

該問題是html檔案許可權問題。用jenkins 並遠端伺服器上傳到另一台伺服器的html 在配置好nginx 的location root 絕對位置後還是報錯500 手工用root上傳時訪問正常。經發現用jenkins上傳時檔案許可權比手工上傳的少一些,所以在該遠端伺服器將分配好許可權,然後以及r...

日常記錄 Nginx 訪問403解決過程

開啟錯誤日誌記錄,檢視ngnix錯誤日誌 error.log 2020 02 12 20 20 34 error 29889 0 1 web index.html is forbidden 13 permission denied client 127.0.0.1,server localhost,...