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

**URL:** https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246
**Category:** Support
**Created:** [11 februari 2017 om 13:49 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246 "2017-02-11T13:49:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![evert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/evert/32/300908_2.png) [@evert](https://meta.discourse.org/u/evert)
#### Post date: [11 februari 2017 om 13:49 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246/1 "2017-02-11T13:49:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [11 februari 2017 om 17:26 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246/2 "2017-02-11T17:26:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Lutz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lutz/32/65103_2.png) [@Lutz](https://meta.discourse.org/u/Lutz)
#### Post date: [11 februari 2017 om 17:36 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246/3 "2017-02-11T17:36:06Z")

</div>

Add something like this to your nginx.conf:

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

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

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [11 februari 2017 om 18:05 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246/4 "2017-02-11T18:05:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![evert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/evert/32/300908_2.png) [@evert](https://meta.discourse.org/u/evert)
#### Post date: [14 februari 2017 om 16:11 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246/5 "2017-02-14T16:11:13Z")

</div>

I went for your suggestion. Easiest indeed.

Thanks! 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2 mei 2019 om 11:32 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246/6 "2019-05-02T11:32:39Z")

</div>



---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2 mei 2019 om 16:05 UTC](https://meta.discourse.org/t/how-do-i-make-my-site-only-listening-on-its-hostname-and-no-longer-on-its-ip/57246/7 "2019-05-02T16:05:19Z")

</div>


