I know it's possible to server static files using error_page in NGinx, but I was wondering if it was possible to server an url from my local (socketed) Flask app that is served through UWsgi.
Here's the NGinx configuration :
server {
listen 80;
server_name www.myproject.com;
access_log /var/log/nginx/myproject_frontend.access.log;
error_log /var/log/nginx/myproject_frontend.error.log;
# Something like :
error_page 404 uwsgi_pass unix:/tmp/uwsgi_myproject.sock;/errors/404
location / { try_files $uri @yourapplication; }
location @yourapplication {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi_myproject.sock;
}
}
Is this possible? Would it work if instead of a socket I would allow a local (127.0.0.1) only access ?
Thank you for your insighs.
Best Answer
Try to replace:
by:
source: http://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_intercept_errors