Home Putting Ghost Blog Admin on SSL Nginx
Post
Cancel

Putting Ghost Blog Admin on SSL Nginx

I followed this guide to make a self-signed SSL cert on this server. I put a similar configuration like below for nginx in /etc/nginx/sites-available/ghost.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
server {
    listen 80;
    listen [::]:80 ipv6only=on;

    server_name your-domain.com; # Replace with your domain

    location ^~ / {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_set_header X-NginX-Proxy true;

       proxy_pass http://127.0.0.1:2368;
       proxy_redirect off;
    }

    location ^~ /ghost {
       rewrite ^ https://$http_host$request_uri? permanent;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ipv6only=on ssl;

    server_name your-domain.com; # Replace with your domain

    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;

    location ^~ / {
       rewrite ^ http://$http_host$request_uri? permanent;
    }

    location ^~ /ghost {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_set_header X-NginX-Proxy true;

       proxy_pass http://127.0.0.1:2368;
       proxy_redirect off;
    }
}
This post is licensed under CC BY 4.0 by the author.