Configure Nginx redirect HTTP to HTTPS?

Jovani

Active member
Joined
Jul 10, 2012
Messages
338
Points
28
I'm trying to Nginx on my vps and as I knew then Google give better rankings for https protocol hence are there any ways to redirect from HTTP to HTTPS on Nginx? please suggest me :)
 

Alex Thompson

Moderator
Joined
Jun 6, 2013
Messages
651
Points
43
I'm trying to Nginx on my vps and as I knew then Google give better rankings for https protocol hence are there any ways to redirect from HTTP to HTTPS on Nginx? please suggest me :)
Hey Jovani,

After you installed SSL completely, you follow simple steps to redirect from http to htpps with nginx
The first, find the file nginx.conf or you can edit file in folder /etc/nginx/conf.d/

rewrite ^ https://$server_name$request_uri? permanent;
Finally, you will have file with content as following:
server {
server_name www.yourdomain.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
Restart Nginx
service nginx restart
Hope it helps!
 
Latest threads
Replies
1
Views
74
Replies
1
Views
172
Replies
4
Views
378
Replies
11
Views
522
Replies
2
Views
227

Latest postsNew threads

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top