Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx (13: Permission denied) while connecting to upstream

I'm deploying my Djano application on a VPS and I'm following the steps in the below link to configure my app with Gunicorn and Nginx.

How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 16.04

Everything went well with the tutorial (gunicorn and nginx are running) but the issue is that when Im' visiting the VPS through the static IP its showing a white screen that is always reloading.

After checking nginx log I found the following:

(13: Permission denied) while connecting to upstream, client: <client_ip>, server: <server_ip>, request: "GET / HTTP/1.1, upstream: "http://unix:/root/myproject/myproject.sock:/", host: "<server_ip>", referrer: "http://<server_ip>/"

like image 693
Osama Radwan Avatar asked Jan 20 '26 07:01

Osama Radwan


1 Answers

After searching for roughly 7 hours, I was finally able to find a solution to this issue in the Nginx forum:

Nginx connet to .sock failed (13:Permission denied) - 502 bad gateway

What I simply did was changing the name of the user on the first line in /etc/nginx/nginx.conf file.

In my case the default user was www-data and I changed it to my root machine username.

like image 134
Osama Radwan Avatar answered Jan 23 '26 03:01

Osama Radwan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!