Www to non-www on 3.1.1

Including this forum I inveled all the resources I found and followed the instructions I trusted, but I couldn’t redirect www-to-non-www.on Ghost 3.1.1-Digital Ocean. Could you help me?

Just for clarity, you want to redirect example.com to www.example.com?

I think like my blog www.dasnetzundich.de

Www to non-www

My setup for redirect:

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

server_name www.dasnetzundich.de;
root /var/www/ghost/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

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;
    #proxy_pass http://127.0.0.1:2368;
    return 301 https://dasnetzundich.de$request_uri;
}

location ~ /.well-known {
    allow all;
}

client_max_body_size 50m;

}

You want to redirect www.dasnetzundich.de to dasnetzundich.de? If so, you need to make sure you actually have a server block for dasnetzundich.de and then you need a server block like the following

server {
  listen 80;

  server_name www.dasnetzundich.de;
  return 301 http://dasnetzundich.de$request_uri;
}

Yes, for me it works fine :slight_smile:

Firstly thank you for all the support in this forum for new ones like myself.

I am also new to ghost making the leap from wordpress on shared hosting platforms.
I followed these instructions and it ddnt get success. after i activated the www block and used the exact format as directed by @omisnomis I still get that insecure warning to proceed. quite frustrating. What else could i be doing wrong. If anyone has a moment to spare.

I created the serverblock. Used the entry above with my domain, then I ln -s 'd it into sites-enabled
I did restart the nginx service.

Thank you