Answer the question
In order to leave comments, you need to log in
Deploy 2 sites on vps?
I have a django project. I want to upload it to vps where there is already a static site.
config /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/Era;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name eraart.ru;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/Era;
internal;
}
}
Этот код(django) я добавил в конфиг уже после
upstream app_server {
server unix:/home/split/Blog-Boards/run/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.site.com;
keepalive_timeout 5;
client_max_body_size 4G;
access_log /home/split/Blog-Boards/logs/nginx-access.log;
error_log /home/split/Blog-Boards/logs/nginx-error.log;
location /static/ {
alias /home/split/Blog-Boards/static_root/;
}
# checks for static file, if not found proxy to app
location / {
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question