0

Iam serving flask by nginx and uwsgi but i am getting a permission error

Iam newbie with nginx

/var/log/nginx/error.log

 *1 connect() to unix:///usr/share/nginx/html/myproject/myproject.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.100.137, server: 192.168.100.137, request: "GET /myproject/ HTTP/1.1", upstream: "uwsgi://unix:///usr/share/nginx/html/myproject/myproject.sock:", host: "192.168.100.137

/etc/nginx/sites-available/myproject

server {
    listen 80;
    server_name 192.168.100.137;

    location  /myproject {

        include uwsgi_params;
        uwsgi_pass unix:///usr/share/nginx/html/myproject/myproject.sock;
    }
}

/etc/systemd/system/myproject.service

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

[Service]
User=usama
Group=www-data
PrivateTmp=false
PrivateTmp=No
WorkingDirectory=/usr/share/nginx/html
Environment="PATH=/usr/share/nginx/html/myproject/venv/bin"
ExecStart=/usr/share/nginx/html/myproject/venv/bin/uwsgi --ini myproject.ini
[Install]
WantedBy=multi-user.target

/usr/share/nginx/html/myproject/myproject.ini

[uwsgi]
module = wsgi:app

master = true
processes = 5

socket = myproject.sock
chmod-socket = 666
vacuum = true
die-on-term = true

hope find an anwser

  • uwsgi_pass unix:///usr/share/nginx/html/myproject/myproject.sock; should be uwsgi_pass unix:/usr/share/nginx/html/myproject/myproject.sock;. See uwsgi_pass – mforsetti May 28 at 9:26
  • both are the same – black snow May 31 at 6:24
  • i am still getting this error – black snow May 31 at 6:24
  • Change socket config value on your uWSGI config from myproject.sock to /usr/share/nginx/html/myproject/myproject.sock. – mforsetti May 31 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.