Difference between revisions of "Nginx SSL redirect"

From KOP KB
Jump to: navigation, search
(Created page with "<syntaxhighlight lang="nginx"> server{ listen 80; server_name domain.com www.domain.com; rewrite ^ https://$host$request_uri permanent; } </syntaxhighlight>")
 
 
Line 1: Line 1:
 +
A basic ssl redirect, now if your are not doing default ports for ssl. You will need to put the port in between host and request_uri so it goes to the right place.
 
<syntaxhighlight lang="nginx">
 
<syntaxhighlight lang="nginx">
 
server{
 
server{

Latest revision as of 22:12, 10 August 2017

A basic ssl redirect, now if your are not doing default ports for ssl. You will need to put the port in between host and request_uri so it goes to the right place.

server{
listen 80;
server_name domain.com www.domain.com;
 rewrite ^    https://$host$request_uri permanent;
}