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

faq-material

(Evert Meulie) #1

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.


(Jay Pfaffman) #2

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


(Lutz Biermann) #3

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;
}

(Jay Pfaffman) #4

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


(Evert Meulie) #5

I went for your suggestion. Easiest indeed.

Thanks! :slight_smile: