Доброго дня!
Имеется nginx в docker контейнере, работающий в качестве прокси сервера.
При явном указании http:// server_name - не происходит редирект на https.
Моя конфигурация:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name server_name;
ssl_certificate /etc/ssl/server_name/fullchain.pem;
ssl_certificate_key /etc/ssl/server_name/privkey.pem;
access_log /var/log/nginx/server_name.log;
error_log /var/log/nginx/server_name.log;
location / {
proxy_pass https://10.3.47.16;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen 443 ssl;
server_name git.server_name;
ssl_certificate /etc/ssl/server_name/fullchain.pem;
ssl_certificate_key /etc/ssl/server_name/privkey.pem;
access_log /var/log/nginx/git.server_name.log;
error_log /var/log/nginx/git.server_name.log;
location / {
proxy_pass https://10.3.47.65;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}