I installed ghost on a newly installed VPS server, following the default guide.
I noticed that the domain.com is correct, it is the main one and takes me to the ghost site.
If I connect to www.domain.com, it takes me to the nginx welcome page.
Shouldn’t it take me to domain.com without the www? (as I wish it were)
The dns records are set up like this:
A - domain.com - IP
CNAME - www - domain.com
CNAME - ftp - domain.com
EDIT:
I noticed that ftp.domain.com takes me to the site, keeping the domain ftp.domain.com, instead of redirecting domain.com.
There is something wrong.
these are the two files that the ghost installation generated for nginx:
domain.com.conf
server {
listen 80;
listen [::]:80;
server_name domain.com;
root /var/www/ghost/system/nginx-root;
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;
}
location ~ /.well-known {
allow all;
}
client_max_body_size 50m;
}
domain.com-ssl.conf
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name domain.com;
root /var/www/ghost/system/nginx-root;
ssl_certificate /etc/letsencrypt/domain.com/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/domain.com/domain.com.key;
include /etc/nginx/snippets/ssl-params.conf;
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;
}
location ~ /.well-known {
allow all;
}
client_max_body_size 50m;
}
What am I doing wrong?
Thank you