Redirect non www to www SSL for Ghost CMS

I had set up a Ghost blog using their default Ghost CLI. The options I selected were having a domain, ssl, and using nginx.

In order to have forward to, I edited the default nginx file.

vi /etc/nginx/sites-enabled/

I added to the server-name alongside

server {
    listen 80;
    listen [::]:80;

    root /var/www/; # Used for SSL verification (

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        return 301$request_uri;

    location ~ /.well-known {
        allow all;

    client_max_body_size 50m;
Show Comments