400 error with nginx subdomains over https
Posted
by
aquavitae
on Server Fault
See other posts from Server Fault
or by aquavitae
Published on 2014-08-25T08:30:51Z
Indexed on
2014/08/25
10:21 UTC
Read the original article
Hit count: 241
Not sure what I'm doing wrong, but I'm trying to get gunicorn/django through nginx using only https. Here is my nginx configuration:
upstream app_server {
server unix:/srv/django/app/run/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name app.mydomain.com;
ssl on;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
client_max_body_size 4G;
access_log /srv/django/app/logs/nginx-access.log;
error_log /srv/django/app/logs/nginx-error.log;
location /static/ {
alias /srv/django/app/data/static/;
}
location /media/ {
alias /wrv/django/app/data/media/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_pass http://app_server;
}
}
I get a 400 error on app.mydomain.com
, but the app is published on mydomain.com
. Is there an error in my configuration?
© Server Fault or respective owner