'sock failed (13: Permission denied) while connecting to upstream

i'm trying to host my flask aplication with uwsgi and nginx on digitalocean but when i visit the website i get the error "502 Bad Gateway" and when i check the error logs by typing sudo less /var/log/nginx/error.log in the server command line i see the error: "connect() to unix:/root/website/websitesock.sock failed (13: Permission denied) while connecting to upstream"

but when i run the uwsgi localy and i visit the ip with port it works. and when i check the status of nginz with service nginx status i doesn't give any errors. i followed this tutorial digitalocean from digitalocean

ini file

[uwsgi]
module = wsgi:app

master = true
processes = 5

socket = websitesock.sock
chmod-socket = 664
uid = www-data
gid = www-data
vacuum = true

die-on-term = true

service file

[Unit]
Description=uWSGI instance to serve myproject
After=network.target

[Service]
User=root
Group=www-data
WorkingDirectory=/root/websitefolder
Environment="PATH=/root/wesbitefolder/myprojectenv/bin"
ExecStart=/root/websitefolder/myprojectenv/bin/uwsgi --ini test.ini

[Install]
WantedBy=multi-user.target

i have tried adding/giving premission to the socket and uwsgi and nginx this changed nothing



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source