問題描述:nginx 反向代理自己的服務 502,代理 www.baidu.com 是 ok 的
問題解決:
檢視nginx的error log,說permission denied, 想到selinux,把它關閉就ok了。
關閉Selinux
關閉指令
setenforce 0
檢視錯誤日志
centos linux下檢視 nginx 預設 日志 位置 實時檢視顯示日志
- 首先nginx配置檔案在centos7下是在
/etc/nginx/nginx.conf
中
#預設是沒有打開的,需要修噶配置檔案打開
error_log /var/log/nginx/error.log warn;
#錯誤日志有幾個等級,開啟warn以上級别的錯誤
- 修改後測試
nginx -t
顯示結果
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
再次通路自己本地的服務,應該可以了