Hello, that’s very easy to accomplish, all you have to do is include the www in your Nginx .conf
file, here is an example:
server {
server_name example.com www.example.com;
root /var/www/ghost;
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:2369;
}
location ~ /.well-known {
allow all;
}
client_max_body_size 50m;
}
If you’d like to know more about it in detailed, I’ve written a little article about it:
https://elkepon.com/run-ghost-and-other-websites-using-nginx-webserver-on-ubuntu-16-04/
You need to point it to your DNS provider, I forgot about that part, for example:
In AWS, if you go to route53, you can add an ALIAS, your alias target would be example.com and the name: www.example.com
That’s almost as if you were creating a sub domain, but you’re creating an ALIAS
By the way your post is repeated: How can I setup a domain alias?