I have already gone through some previous threads: How do I set subdirectory in nginx with Django how to deploy django under a suburl behind nginx Serving flask app on subdirect
Since uwsgi_modifier1 30
is removed in the latest versions and I felt like the mount-point stuff was too hacky, I had to use a newer method to serve Django in a subdirectory:
[uwsgi]
socket = /tmp/project.sock
# Requires PCRE support compiled into uWSGI
route-run = fixpathinfo:
location /project {
include /etc/nginx/uwsgi_params;
uwsgi_pass unix:/tmp/project.sock;
uwsgi_param SCRIPT_NAME /project; # Pass the URL prefix to uWSGI so the "fixpathinfo:" route-rule can strip it out
}
fixpathinfo:
requires PCRE support to be compiled into uWSGI.So if things aren't working, try installing libpcre and libpcre-dev, then recompile uwsgi with pip install -I --no-cache-dir uwsgi
. uWSGI's internal routing subsystem requires the PCRE library to be installed before uWSGI is compiled/installed. More information on uWSGI and PCRE.