2

On my development system I'm running a Flask WSGI application with uwsgi and nginx. However on the production server I need to use Apache instead of nginx, so I'm trying to do that. In nginx the site is mounted like this:

location /flaskapp { uwsgi_pass unix:/tmp/flaskapp.sock; }

and it works. In Apache I tried this:

 ProxyPass /flaskapp unix:/tmp/flaskapp.sock|uwsgi://flaskapp

which gives me a 503 error with this in the logfile:

[Fri Jan 01 13:19:45.551524 2021] [proxy:error] [pid 14167] (2)No such file or directory: AH02454: uwsgi: attempt to connect to Unix domain socket /tmp/flaskapp.sock (flaskapp) failed
[Fri Jan 01 13:19:45.551802 2021] [:error] [pid 14167] [client ::1:48950] AH10101: failed to make connection to backend: httpd-UDS:0

I enabled both mod_proxy and mod_proxy_uwsgi modules. I don't understand the "no such file or directory" bit. The socket file is clearly where it's supposed to be.

Of course I stopped nginx and then re-started Apache to prevent nginx from keeping a hold on that socket.

The documentation of the ProxyPass directive doesn't explain what the part after the pipe ("|") character means so I don't know what to put there and why.

musbur
  • 193
  • 12

1 Answers1

1

I had a similar setup for a Django application and resolved this error message by moving the location of the socket file from /tmp to /var/lib/uwsgi. Make sure that /var/lib/uwsgi is owned by the same user and group that your web server and uWSGI run under so that uWSGI can create the socket file.

PaulR
  • 331
  • 3
  • 8