Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6066

Invalid HTTP_HOST on Django (EC2 Aws Ubuntu)

$
0
0

I'm having trouble deploying my Django application. I'm running it using nohup on port 8000 and using nginx with SSL certificate configuration, masking the domain to port 80.

Here are my default Nginx settings:

server {    listen 80;    listen 443 ssl;    server_name fmartns.dev;    ssl_certificate /etc/letsencrypt/live/fmartns.dev/fullchain.pem;    ssl_certificate_key /etc/letsencrypt/live/fmartns.dev/privkey.pem;    location = /favicon.ico { access_log off; log_not_found off; }    location /static/ {        root /home/ubuntu/fmartns.dev;    }    location / {        include proxy_params;        proxy_pass http://3.82.145.23:8000;  # Port where Django is running        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header X-Forwarded-Proto $scheme;    }}

Django's settings.py configuration:

# SECURITY WARNING: don't run with debug turned on in production!DEBUG = TrueALLOWED_HOSTS = ['fmartns.dev', '*']SECURE_CONTENT_TYPE_NOSNIFF = TrueSECURE_BROWSER_XSS_FILTER = TrueSESSION_COOKIE_SECURE = TrueCSRF_COOKIE_SECURE = TrueSECURE_SSL_REDIRECT = TrueSECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')CSRF_TRUSTED_ORIGINS = ['http://fmartns.dev']

Error log:

DisallowedHost at /Invalid HTTP_HOST header: 'fmartns.dev,fmartns.dev'. The domain name provided is not valid according to RFC 1034/1035.

Any ideas on how I can resolve this? I've tried various tutorials and configurations both in my settings.py and in the default nginx settings.


Viewing all articles
Browse latest Browse all 6066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>