Question

Bad gateway error message with Django

I’m getting a bad gateway error. (My own fault for using Youtube)

This is the Nginx error message

2018/01/10 17:07:58 [error] 2210#2210: *5 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 86.167.15.195, server: _, request: “GET / HTTP/1.1”, upstream: “http://unix:/home/django/gunicorn.socket:/”, host: “159.65.16.251” 2018/01/10 17:08:45 [error] 2210#2210: *7 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 86.167.15.195, server: _, request: “GET / HTTP/1.1”, upstream:

Looking at the other questions I changed ALLOWED_HOSTS = [ipaddress] and added ALLOWED_HOSTS += ip_addresses() top the bottom

A really dumb question do I change the secret key on the droplet to the secret key from my project?

WSGI.py

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “django_project.settings”)

application = get_wsgi_application()

URls.py

from django.conf.urls import include, url from django.contrib import admin

urlpatterns = [ url(r’^admin/‘, include(admin.site.urls)), url(r’^‘, include(‘personal.urls’)), url(r’^blog/‘, include(‘blog.urls’)), url(r’^writing/', include(‘writing.urls’)), ]

Subscribe
Share

This is my Nginx,conf

user www-data; worker_processes auto; pid /run/nginx.pid;

events { worker_connections 768; # multi_accept on; }

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}

#mail {

# See sample authentication script at:

# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

# auth_http localhost/auth.php;

# pop3_capabilities “TOP” “USER”;

# imap_capabilities “IMAP4rev1” “UIDPLUS”;

server {

listen localhost:110;

protocol pop3;

proxy on;

}

server {

listen localhost:143;

protocol imap;

proxy on;

}

#}


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Accepted Answer

I managed to get this up and running I just didn’t migrate it.