# rewrite to Https
server {
listen 80;
server_name xxx.xxx.com;

rewrite ^(.*)$ https://$host$1 permanent;
}

server {
listen 443 ssl;
server_name xxx.xxx.com;

ssl_certificate /opt/nginx/ssl/xxxxx.pem;
ssl_certificate_key /opt/nginx/ssl/xxxxx.key;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

underscores_in_headers on;

location ~ /demo {

proxy_set_header Host xxx.xxx.com;

proxy_set_header X-Real-IP $http_x_forwarded_for;

proxy_set_header X-Forwarded-For $http_x_forwarded_for;

proxy_pass http://xxx.service;

}
}