A
A
Alexander Alexandrov2015-06-10 16:34:05
Django
Alexander Alexandrov, 2015-06-10 16:34:05

How to link a domain, nginx + uwsgi + django?

Help a newbie.
I'm trying to host a django project on a vps.
I read a lot of tutorials, including this one habrahabr.ru/post/226419
Now I have a django application running on xxxx:8000 (it works)
And on xxxx - "welcome to nginx
" .ru was loading the site without specifying the port?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Shikanov, 2015-06-10
@pyhamster

Remove all hosts from nginx:
Add host to /etc/nginx/sites-available/<mydomain>:

server {
    listen 80;
    server_name <mydomain>;

    location / {
        proxy_pass  http://localhost:8000;
        proxy_set_header    Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Make a symlink to the host:
Restart Nginx:
/etc/init.d/nginx restart

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question