Redirect non www to www SSL for Ghost CMS

December 17, 2019 — Leave a comment

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;


Posts Twitter Facebook

My name is Michael Le, and I am a web developer.

No Comments

Be the first to start the conversation.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.