A
A
Antonov Dmitry2016-05-11 22:17:20
Django
Antonov Dmitry, 2016-05-11 22:17:20

Django Gunicorn subdomain?

Hello!
I have a site with mysite.ru, everything is spinning using the nginx + gunicorn bundle, the main domain config:

server {
    listen 80;
    server_name mysite.ru;
    access_log  /var/log/nginx/example.log;

        location ~* ^.+\.(jpg|jpeg|gif|png|ico|txt|css|js)$ {
                root /var/www/blog/myblog/;
        }

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }

I decided to run another application on a subdomain, config:
server {
    listen 81;
    server_name test.mysite.ru;
    access_log  /var/log/nginx/example.log;

        location ~* ^.+\.(jpg|jpeg|gif|png|ico|txt|css|js)$ {
                root /var/www/testblog/myblog/;
        }

    location / {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }

In fact, the main mysite.ru works as it should, but test.mysite.ru only works in this format: test.mysite.ru:81, how to fix this problem?
ps And do I need to register a subdomain with the provider?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
un1t, 2016-05-11
@BlackTrub

server {
    listen 81;

Fix for 80.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question