By HHH
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;
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Never mind this fix the error:
cd /etc/nginx/sites-enabled/
sudo rm -r test-django
sudo service nginx restart
* Restarting nginx nginx
and my test-django looks like this now:
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;
}
}
‘default_server’ were deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.