Configure Nginx redirect HTTP to HTTPS?

Jovani

Active member
Joined
Jul 10, 2012
Messages
335
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
652
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
7
Views
109
Replies
2
Views
42
Replies
2
Views
24
Replies
2
Views
29
Replies
1
Views
23
Recommended threads
Replies
95
Views
43,913
Replies
44
Views
28,083
Replies
16
Views
6,679
Replies
3
Views
1,278

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