Quantcast
Channel: CodeSection,代码区,网络安全 - CodeSec
Viewing all articles
Browse latest Browse all 12749

Nginx force SSL

0
0

Need to quickly setup ssl and default to that for our sites.

This article made it simple stupid for getting the certs setup.

Then I wrapped up the redirect as seen below

server { listen 80; listen 443 ssl; server_name somesite-dev.stagingarea.info; root /home/someuser/somesite-dev.stagingarea.info/public; ssl on; ssl_certificate /etc/nginx/ssl/nginx.crt; ssl_certificate_key /etc/nginx/ssl/nginx.key; # Prevent a look if ($ssl_protocol = "") { rewrite ^ https://$server_name$request_uri? permanent; } index index.html index.htm index.php; charset utf-8; }

Thanks to this post as well http://serverfault.com/a/298803

Still a mystery but

service nginx restart

was not working had to do

/etc/init.d/nginx restart

to get the server to reload.


Viewing all articles
Browse latest Browse all 12749