summaryrefslogtreecommitdiff
path: root/_posts/2013-04-26-nginx-permanent-rewrite-http-to-https.md
blob: 8c57a1b823551307eb060808dd58666faf00196d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
layout: post
title: "nginx permanent rewrite http to https"
description: ""
category: "Installation"
tags: ["Linux", "Nginx"]
---
{% include JB/setup %}

For permanent rewrite a http to a https adress in your nginx site-available config file use:

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

    server {
       listen         443;
       server_name    my.domain.com;

       ssl            on;

       [....]
    }