I’m following this tutorial by @asb. But i got this error when I try restart nginx:
[emerg] duplicate upstream "app_server" in /etc/nginx/sites-enabled/test-django:1
The test-django
file in etc/nginx/site-available/ :
upstream app_server {
server 127.0.0.1:9500 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name www.mydomain.com;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/test-django/cmsh/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/test-django/cmsh/static;
}
location / {
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;
}
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Never mind this fix the error:
and my test-django looks like this now:
‘default_server’ were deleted
source