# IP as a server name

**URL:** <https://www.ruby-forum.com/t/ip-as-a-server-name/207474>\
**Category:** NGINX\
**Created:** [May 26, 2011, 12:11pm UTC](https://www.ruby-forum.com/t/ip-as-a-server-name/207474 "2011-05-26T12:11:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 26, 2011, 12:11pm UTC](https://www.ruby-forum.com/t/ip-as-a-server-name/207474/1 "2011-05-26T12:11:51Z")

</div>

Hi there!

I have a question about nginx configuration file. How can I configure a  
server if I want my site to be available under a domain name and IP  
address. I would like to have something like:  
http(s)://myhost.mydomain/foo/  
and  
http(s)://XXX.XXX.XXX.XXX/foo/  
to be available simultaneously.

I noticed that it basically works but problem occurs on redirections  
from my webapp (Nginx is a reverse proxy for it). It seems that on  
redirects nginx is obtaining a server\_name from OS configuration.

Can You please suggest some configuration?

I am using nginx 0.6.39 but will try to upgrade if it is necessary.

Regards

Sławek

Posted at Nginx Forum:

> **[IP as a server name](https://forum.nginx.org/read.php?2,201092,201092#msg-201092)**
>
> Hi there! I have a question about nginx configuration file. How can I configure a server if I want my site to be available under a domain name and IP address. I would like to have something like: http(s)://myhost.mydomain/foo/ and...

---

<div class="post-metadata">

**Author:** ![slafs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e56c9b/32.png) [@slafs](https://www.ruby-forum.com/u/slafs)\
**Post date:** [May 26, 2011, 12:31pm UTC](https://www.ruby-forum.com/t/ip-as-a-server-name/207474/2 "2011-05-26T12:31:01Z")

</div>

Ok found it. Sorry.

server\_name\_in\_redirect off;

did the trick.

Posted at Nginx Forum:

> **[Re: IP as a server name](https://forum.nginx.org/read.php?2,201092,201100#msg-201100)**
>
> Hi there! I have a question about nginx configuration file. How can I configure a server if I want my site to be available under a domain name and IP address. I would like to have something like: http(s)://myhost.mydomain/foo/ and...
