How do I make my site only listening on its hostname. and no longer on its IP?

Hi all,

I noticed that Google has started indexing my site on its (dynamic!) IP address as well lately. How do I configure Discourse so that it only responds on its configured hostname?

https://forums.meulie.net/ should work/get indexed. http://51.175.33.95 should either redirect to https://forums.meulie.net/ , or simply give some error.

I think the best way is to use HTTPS and force redirects to that URL

1 Like

Add something like this to your nginx.conf:

server {
    listen 51.175.33.95:80;
    server_name 51.175.33.95 forums.meulie.net;

    rewrite  ^/(.*)$  https://forums.meulie.net/$1 permanent;
}
4 Likes

But that needs to get done inside the container. It’s easier to enable let’s encrypt.

6 Likes

I went for your suggestion. Easiest indeed.

Thanks! :slight_smile:

1 Like