Environment information
If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.
If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.
- What’s your URL? https://www.traceyle.id.au
- What version of Ghost are you using? 5.57.2
And
- How was Ghost installed and configured? Digital Ocean 1-click
- What Node version, database, OS & browser are you using? Node 16.17.0, MySQL, Mac OS Monterey, Safari
- What errors or information do you see in the console? None in console, but browser displays
403 Forbidden nginx/1.18.0 (Ubuntu)
or an invalid SSL certificate notice - What steps could someone else take to reproduce the issue you’re having? See below
Context
I have the domain traceyle.id.au
. I’m trying to host my Ghost site on www.traceyle.id.au
and redirect traceyle.id.au
to that.
- I set up an A record for
www.traceyle.id.au
to the IP of my DigitalOcean droplet where I installed Ghost - I set up an A record for
traceyle.id.au
to the same IP - I set up Ghost with the URL
www.traceyle.id.au
- https://www.traceyle.id.au works, but I’m having trouble with figuring out how to get
traceyle.id.au
to redirect tohttps://www.traceyle.id.au
What I’ve tried
I was trying to read up on how this could be done in general (non-specific to Ghost) and I saw solutions suggesting redirects using NGINX. If there’s an easier way, let me know.
Some references include these:
So I tried sudo nano /etc/nginx/sites-available/default
and added this above the default server configuration:
server {
listen 80;
server_name traceyle.id.au;
return 302 $scheme://www.traceyle.id.au$request_uri;
}
(Would change it to 301 for permanent redirect if it works)
And I tried adjusting the default server configuration as follows
server {
server_name www.traceyle.id.au;
listen 80;
listen [::]:80;
# Commented out the following line
# server_name _;
I did make sure to run sudo systemctl restart nginx
after making changes.
What I want to happen
All URLs on traceyle.id.au
redirect to https://www.traceyle.id.au
What actually happened
The results are the same as before I tried those changes.
-
When I tried to visit https://traceyle.id.au I get this notice from Safari. It says the HTTPS certificate is for
www.traceyle.id.au
when I click Show Details
-
When I tried to visit http://traceyle.id.au I just get a 403 forbidden error. (Same with http://www.traceyle.id.au after I tried reverting things back).
- Then I tried this solution on StackOverflow (removing a
$uri/
) but that didn’t help. So I also reverted back.
- Then I tried this solution on StackOverflow (removing a
Reverting back
I ended up commenting out my changes and trying to revert back to the Ghost default NGINX config for that file. (I don’t think I changed anything but I might have accidentally)
The default server configuration for reference:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
(removed the commented lines to keep it condensed)