Answer the question
In order to leave comments, you need to log in
How to properly configure nginx to run a django project on vds?
Here is the config file sites-availabel/default
server {
listen 80;
server_name 194.87.110.108; #либо ip, либо доменное имя
access_log /var/log/nginx/example.log;
location /static/ {
root /opt/myenv/myproject/;
expires 30d;
}
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;
}
}
ALLOWED_HOSTS = ['194.87.110.108']
Answer the question
In order to leave comments, you need to log in
As far as I understand it is necessary
1) in gunicorn --bind 127.0.0.1:8000
2) ALLOWED_HOSTS = ['127.0.0.1']
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question