Help needed in SSL connection to nginx
poojatr opened this issue · 0 comments
poojatr commented
Hey
Thank you so much for the tutotial , its good material for even beginners like me who are starting with docker.
Am trying to attach self created ( via open ssl command) ssl certificate , can you please help me with it
Modified nginx.conf :
upstream hello_django {
server web:8000;
}
server {
listen 80;
location / {
proxy_pass http://hello_django;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /staticfiles/ {
alias /usr/src/app/staticfiles/;
}
}
server{
listen 443 ssl;
ssl_certificate /etc/ssl/nginx.crt;
ssl_certificate_key /etc/ssl/nginx.key;
server_tokens off;
location / {
proxy_pass http://hello_django;
proxy_pass_header Server;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
and i have modified the docker file as
`
nginx:
build: ./nginx
volumes:
- static_volume:/usr/src/app/staticfiles:Z
ports:
- 1337:80
- 8443:443
`
It would be great if you could help me with it, Thanks.
i am following this method to add ssl certificate
The error am getting is
400 Bad Request
The plain HTTP request was sent to HTTPS port