Configure Nginx redirect HTTP to HTTPS

Currently the demand of using security protocol SSL for websites are quite popular because Google has increased the importance of ranking for this site. After installing the SSL success, how to redirect all url from HTTP to HTTPS with the nginx, please refer to this tutorial.

Edit nginx configuration file (/etc/nginx/nginx.conf). Add or modify the redirect structure follows:

rewrite ^ https://$server_name$request_uri? permanent;

Eventually you will be file with content similar to this:

server {
 server_name www.example.com;
 rewrite        ^ https://$server_name$request_uri? permanent;
 }

Restart Nginx:

service nginx restart

 

About Ricky1990

I'm Ricky, a programmer. My interests are Marketing Online, Wordpress, SEO, Make Money Online and Software. Besides computers, i am crazy for bussiness projects, web development consulting and work as a speaker about these fields.

Speak Your Mind

*