I would like to set up Nginx for Flask applications with uWSGI server. I have set the proxy over unix socket as the following.
The initial Nginx configuration:
server {
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/my_app.sock;
}
}
The uWSGI configuration:
[uwsgi]
socket = /tmp/my_app.sock
virtualenv = /home/user/venv/my_app
chdir = /home/user/apps/my_app
wsgi-file = index.py
callable = app
processes = 4
threads = 2
This works but when I change the location in the Nginx config I have get a 404 Not Found error.
server {
location /other_location/ {
include uwsgi_params;
uwsgi_pass unix:/tmp/my_app.sock;
}
}
The error possibly comes from the uWSGI server (because for other invalid URL the error page writes the Nginx version). I have checked the uWSGI log but it contains only the details about sending the error page with success.
=> generated 233 bytes in 15 msecs (HTTP/1.1 404) 2 headers in 72 bytes
How can I configure Nginx and uWSGI for working with non root locations?
Is it necessary to set the application route in the source code of the application?
I prefer solutions where I can use the unmodified application code. I like to separate the application development and deployment as possible.