0

The current situation is as follows: I have a domain at a specific provider (manitu.de) I have a free tier VPS with Oracle I want to set up a ghost blog on the oracle VPS that should be reachable via the domain I have at manitu.de

So this is what happened until now: I’ve set the IPv4 Forward-DNS A record for mydomain.de to forward to the IP of the Oracle server (let’s assume 1.2.3.4). During the ghost installation, it asks me for the name of my blog. So if I go and provide 1.2.3.4 as IP, I can reach the blog by using 1.2.3.4/ghost as well as mydomain.de/ghost - which is nice.

My problem: if I enter mydomain.de (or mydomain.de/ghost fwiw) in the address bar, it redirects to 1.2.3.4 which I want to avoid. That’s what I haven’t been able to solve properly yet because either it doesn’t redirect anywhere at all or I get stuck in a loop of redirections.

This is what my configuration looks like which is created by ghost during the installation process which I have added the second server block to:

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

    server_name mydomain.de;
    root /var/www/mydomain/system/nginx-root; # Used for acme.sh SSL verification>

    return 301 $scheme://mydomain.de$request_uri;

    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; # 2368 being the port ghost is using

    }

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

server {
    listen 80;
    server_name 1.2.3.4;
    return 301 $scheme://mydomain.de$request_uri;
}

Thanks in advance!

awake
  • 1

1 Answers1

1

Since you have configured the root URL of your application to be an IP address, then the application makes sure all requests are made to the root URL of the application.

So, the proper solution is to set the root URL of the application properly. After that, accessing the application with an IP address will redirect it to the root URL.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • Hey there, thanks for answering. So basically I need to switch out the IP in my second server block for the right domain? – awake Mar 18 '22 at 07:50
  • That and then configure the root URL properly in your application (ghost). – Tero Kilkanen Mar 18 '22 at 08:06
  • Thank you. So when I use `mydomain.de` as URL for ghost and change my config file accordingly, my domain provider displays a message that the page can not be reached and is telling me that the site has not been configured yet. – awake Mar 18 '22 at 08:49
  • Have you configured the DNS records properly? – Tero Kilkanen Mar 18 '22 at 22:55
  • Hey Tero, thanks for the patience. So if I check my DNS propagation with something like [DNS Checker](https://dnschecker.org) and enter my domain, my DNS apparently has propagated properly. – awake Mar 21 '22 at 06:58
  • Do you see entries in your access.log when you visit the domain? – Tero Kilkanen Mar 21 '22 at 19:00