server { ssl on; listen 171.221.7.50:443; server_name test.com; ssl_certificate ../ssl/hixz.org.crt; ssl_certificate_key ../ssl/hixz.org.key; location / { proxy_pass http://127.0.0.1:80; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header From-Https on; } } server { listen 80; server_name test.com; rewrite ^(.*) https://test.com$1 permanent; }