#How can i create a subdomain to deploy django as api and in the main domain run react native
4 messages · Page 1 of 1 (latest)
i am getting BAD REQUEST 400 when i access sub.domain.com, i have this nginx file in /etc/nginx/sites-available/sub.domain, it loaded the without the error when i had DEBUG=True and `` ALLOWED_HOST = ["*"] in django settings. the django is running on 0.0.0.0:8000 with gunicorn. i changes them and now it is showing 400.
server_tokens off;
access_log /var/log/nginx/sub.domain.com.access.log;
error_log /var/log/nginx/sub.domain.com.error.log;
# Return 444 status code & close connections if no Host header present
server {
listen 80;
return 444;
}
# Redirect HTTP to HTTPS
server {
server_name sub.domain.com;
listen 80;
return 307 https://$host$request_uri;
}
server {
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static {
autoindex on;
alias /var/www/sub.domain.com/static/;
}
listen 443 ssl; # managed by Certbot
# rest that cerbot generated
}```