詳解Nginx 13: Permission denied 解決方案
今天在用uwsgi+nginx在部署flask應(yīng)用時(shí),遇到502的錯(cuò)誤,vim /var/log/nginx/error.log查看nginx的錯(cuò)誤日志,提示如下錯(cuò)誤信息:
2018/07/22 00:46:36 [crit] 15890#15890: *74 connect() to unix:/root/jianshuvue/jianshu.sock failed (13: Permission denied) while connecting to upstream, client: 120.42.13.98, server: jianshu.weiweiblog.cn, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/root/jianshuvue/jianshu.sock:", host: "jianshu.weiweiblog.cn", referrer: "http://jianshu.weiweiblog.cn/jianshu/67eb7ed414d3"
Permission denied,一看就知道是權(quán)限出了問(wèn)題,通過(guò)ps -ef | grep nginx,查看nginx的進(jìn)程信息:
root 15889 1 0 00:01 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 15890 15889 0 00:01 ? 00:00:00 nginx: worker process
root 16795 15654 0 00:48 pts/3 00:00:00 grep --color=auto nginx
發(fā)現(xiàn)nginx進(jìn)程的用戶是nginx,而我們創(chuàng)建/root/jianshuvue/jianshu.sock文件的用戶是root,因此,只要把nginx的進(jìn)程user改為root即可,vim /etc/nginx/nginx.conf:
# user www-data; user root; worker_processes auto; pid /run/nginx.pid;
之后,/etc/init.d/nginx restart重啟nginx,就可以正常訪問(wèn)網(wǎng)站了。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持本站。
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
 關(guān)注官方微信
                    關(guān)注官方微信