upstream app_name {
server unix:/home/geouser/pmapp/pmapp.sock fail_timeout=10;
}
server {
listen 80;
root /home/geouser/pmapp;
server_name www.officinecartografiche.it, officinecartografiche.it, 207.154.206.172;
location /pmapp/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_name/;
}
}
and I can access the "it works" page from: http://my domain/pmapp
Il giorno lunedì 27 novembre 2017 21:28:55 UTC+1, Matemática A3K ha scritto:
Then you have no need to have 2 nginx confs, just put that the proxy_pass "starts" in your prefix instead of rootand change STATIC_URL and MEDIA_URLAlso, the FORCE_SCRIPT_NAME should also work, but if it doesn't, the first is the most "manual" thing you can do, I think...On Mon, Nov 27, 2017 at 8:32 AM, Luca Moiana <luca....@gmail.com> wrote:Googling around I found this page http://albertoconnor.ca/--hosting-django-under- but ain't working for medifferent-locations.html
Il giorno lunedì 27 novembre 2017 11:10:50 UTC+1, Etienne Robillard ha scritto: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.
Etiennephp?2,275684,275706
Le 2017-11-26 à 15:41, Matemática A3K a écrit :
HTH :)I don't know / remember how to do it in Gunicorn, but here is an example with 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).
https://stackoverflow.com/questions/35792409/nginx- serving-django-in-a- subdirectory-through-uwsgi
--
On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana <luca....@gmail.com> wrote:
Hi,
Sorry for the slight OT but after days of search I have no clue.
Following this DigitalOcean tutorial 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 HTMLmydomain.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/officinecartogra
fiche .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/ http://$host/pmapp/;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!!!
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.--
You received this message because you are subscribed to the Google Groups "Django users" group.com .
To post to this group, send email to django...@googlegroups.com.
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
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 django-users...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
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
For more options, visit https://groups.google.com/d/optout .
-- Etienne Robillard tka...@yandex.com 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 django-users...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
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/d15cf9a9- .9f60-49c4-ad6b-b89ad2f78cde% 40googlegroups.com
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/321f9296-6c85-4afb-a411-a6b0f29445a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment