Thanks for your reply, although it sounds hard for a noob like me. Just to understand, the trick should be done on Gunicorn or on NGINX ?
Il giorno lunedì 27 novembre 2017 11:29:01 UTC+1, Matemática A3K ha scritto: > > That's good to know, I tried to do it some time ago, it was an attempt of > a "sort-of-tennats" which at the didn't go so I stop doing it. At that > moment, I remember trying with gunicorn without success and I was near > success with uWSGi but didn't make it at that time. I supposed that know > would be solved as the s-o question reports success. > > Seems that the easiest way to go is to prefix all urls in Django with the > mount point - provided that no url is hardcoded in the django project - and > use a "regular" nginx conf... > > On Mon, Nov 27, 2017 at 7:09 AM, Etienne Robillard <[email protected] > <javascript:>> wrote: > >> I have not been able to solve this problem with uWSGI. Apparently, uWSGI >> is not using the same internal routing semantics than FastCGI. >> >> See: https://forum.nginx.org/read.php?2,275684,275706 >> Etienne >> >> >> Le 2017-11-26 à 15:41, Matemática A3K a écrit : >> >> I don't know / remember how to do it in Gunicorn, but here is an example >> with uWSGI: >> >> https://stackoverflow.com/questions/35792409/nginx-serving-django-in-a-subdirectory-through-uwsgi >> >> The main thing is that you will have to deal with "/pmapp" prefix in your >> routing / urls. You can deal with this inside Django or have it stripped >> before it gets to Django (by nginx or gunicorn). >> >> HTH :) >> >> On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana <[email protected] >> <javascript:>> wrote: >> >>> Hi, >>> >>> Sorry for the slight OT but after days of search I have no clue. >>> >>> >>> Following this DigitalOcean tutorial >>> <https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04> >>> I >>> was able to setup Django + Postgres + Gunicorn + NGINX running Django on my >>> root, >>> >>> Now I'd like to change and have something like this: >>> >>> mydomain.com -> static HTML >>> mydomain.com/pmapp -> Django app >>> >>> I created two server blocks in NGINX, one for my static website: >>> >>> server { >>> >>> listen 80; >>> >>> listen [::]:80; >>> >>> >>> >>> root /var/www/html/officinecartografiche.it; >>> >>> index index.html index.htm index.nginx-debian.html; >>> >>> >>> >>> server_name www.officinecartografiche.it, officinecartografiche. >>> it, 207.154.206.172; >>> >>> >>> >>> location / { >>> >>> try_files $uri $uri/ =404; >>> >>> } >>> >>> } >>> >>> and one for my django app: >>> >>> server { >>> >>> listen 80; >>> >>> listen [::]:80; >>> >>> server_name www.officinecartografiche.it, officinecartografiche.it, >>> 207.154.206.172; >>> >>> location = /favicon.ico { access_log off; log_not_found off; } >>> >>> location /static/ { >>> >>> root /home/geouser/pmapp; >>> >>> } >>> >>> >>> >>> location /pmapp { >>> >>> #include proxy_params; >>> >>> proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock; >>> >>> proxy_redirect http://www.officinecartografiche.it:8000/pmapp/ >>> http://$host/pmapp/; >>> >>> proxy_set_header SCRIPT_NAME /pmapp; >>> >>> } >>> >>> } >>> >>> and added this to settings.py: >>> >>> FORCE_SCRIPT_NAME = *'/pmapp'* >>> >>> >>> WHAT AM I DOING WRONG?? >>> >>> THANKS FOR YOUR HELP!!! >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> To post to this group, send email to [email protected] >>> <javascript:>. >>> Visit this group at https://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%2BWi1Xt9R7o07bgOwqLGsjw%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/django-users/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%2BWi1Xt9R7o07bgOwqLGsjw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> Etienne [email protected] >> <javascript:>https://www.isotopesoftware.ca/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/f183b36b-2126-0ed9-ec86-5f7736856450%40yandex.com >> >> <https://groups.google.com/d/msgid/django-users/f183b36b-2126-0ed9-ec86-5f7736856450%40yandex.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/83effc3b-b3fd-4ea8-962c-666b93a8d42e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

