I have a Ghost blog hosted on digitalocean, my domain can only be accessible with a secure connection (it's a .dev
site).
My site is available when I access it with www
, e.g. www.androidoss.dev, but not when accessed directly as androidoss.dev.
What could be the issue?
If you have deployed the Ghost on the DigitalOcean server then it's running behind the Nginx probably. So during the Ghost installation there a command is executed which is ghost setup nginx
which setup Nginx for you and then run ghost setup ssl
which set up Let's Encrypt SSL for the provided domain name and it doesn't create a redirection rule from non-www
to www
.
So you can do this by adding a redirection URI in your Nginx file.
You have to add these lines in the server block for http
. It will look like this and the file-path is /etc/nginx/sites-available/ww.example.com
server {
listen 80;
...................
...................
}
you have to add the below lines at the place of dotted lines.
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri;