Deploy Django and Nginx under subpath
I'm trying to deploy a Django app with Gunicorn and Nginx under a subpath, I'm inside a corporate network, and the path www.example.com/myapp points to the IP 192.168.192.77:8080 of my PC on the local network (I have no control over the pathing nor the corporate network, just that port exposed to the internet through /myapp). I tried many things including this: How to host a Django project in a subpath? , but it doesn't show the Django welcome page, just the Nginx welcome page. I also can't access to the Django admin page that should be on the path /myapp/admin, just a 404 page.
This is the config of my site on the folder sites-available for Nginx:
server {
listen 8080;
server_name 192.168.192.77;
location /myapp/static/ {
root /home/user/myapp;
}
location /myapp/ {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
I tried proxy_set_header SCRIPT_NAME /myapp; but it didn't work.
If I don't configure any paths, it shows the django welcome page at /myapp but then I can't acces /myapp/admin, also a 404.
Curiously, if I start the Django development server using python manage.py runserver without nginx it works, the django welcome page shows at /myapp and I can access /myapp/admin with the only problem that the CSS files don't load.
I already have FORCE_SCRIPT_NAME = /myapp and STATIC_URL = /myapp/staticin settings.py for Django.
In conclusion, how do I deploy this Django app to a subpath?