'SSL implementation on custom port for django application using nginx
I am trying to host multiple django applications on the same IP. I have an django application on hosted on specific port 8001 with domain name (domain_name.com). Now on accessing https://domain_name.com, application runs pretty well, But on http://domain_name.com , another applciation hosted in port 80 loads. On accessing 'domain_name.com' how can i redirect to port 8001 for both http and https requests ?
My nginx conf for domain is as below.
server {
listen 8001;
server_name erostreasures.com www.erostreasures.com;
location = /favicon.ico { access_log off; log_not_found off; }
location / {
include proxy_params;
proxy_pass http://unix:/run/agmarket.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/erostreasures.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/erostreasures.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
