# Connecting to localhost or 127.0.0.1 pain

**URL:** <https://www.ruby-forum.com/t/connecting-to-localhost-or-127-0-0-1-pain/185452>\
**Category:** NGINX\
**Created:** [March 20, 2010, 11:16am UTC](https://www.ruby-forum.com/t/connecting-to-localhost-or-127-0-0-1-pain/185452 "2010-03-20T11:16:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [March 20, 2010, 11:16am UTC](https://www.ruby-forum.com/t/connecting-to-localhost-or-127-0-0-1-pain/185452/1 "2010-03-20T11:16:48Z")

</div>

Hi,

I’m having terrible pains trying to connect a server application to  
another localhost server application.

app1 connects to app2 using [http://localhost](http://localhost) but nginx doesn’t seem to  
understand the request.

Should I add localhost to the server\_name???

Regards,

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [March 20, 2010, 1:19pm UTC](https://www.ruby-forum.com/t/connecting-to-localhost-or-127-0-0-1-pain/185452/2 "2010-03-20T13:19:48Z")

</div>

> app1 connects to app2 using [http://localhost](http://localhost) but nginx  
> doesn’t seem to  
> understand the request.
> 
> Should I add localhost to the server\_name???

yes, that would maybe help.

alternatively add “default” to the server\_name.

hth

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [March 20, 2010, 2:42pm UTC](https://www.ruby-forum.com/t/connecting-to-localhost-or-127-0-0-1-pain/185452/3 "2010-03-20T14:42:09Z")

</div>

> > Should I add localhost to the server\_name???
> 
> yes, that would maybe help.
> 
> alternatively add “default” to the server\_name.  
> Thanks 🙂

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [March 20, 2010, 8:41pm UTC](https://www.ruby-forum.com/t/connecting-to-localhost-or-127-0-0-1-pain/185452/4 "2010-03-20T20:41:08Z")

</div>

Hello!

On Sat, Mar 20, 2010 at 01:16:28PM +0100, Alexander Vogt wrote:

> > app1 connects to app2 using [http://localhost](http://localhost) but nginx doesn’t  
> > seem to  
> > understand the request.
> > 
> > Should I add localhost to the server\_name???
> 
> yes, that would maybe help.
> 
> alternatively add “default” to the server\_name.

s/server\_name/listen/.

Adding “default” to the server\_name does nothing, it just adds  
another server alias “default”.

More details may be found here:

> **[Server names](http://nginx.org/en/docs/http/server_names.html)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [March 21, 2010, 3:13pm UTC](https://www.ruby-forum.com/t/connecting-to-localhost-or-127-0-0-1-pain/185452/5 "2010-03-21T15:13:49Z")

</div>

> > alternatively add “default” to the server\_name.
> 
> s/server\_name/listen/.
> 
> Adding “default” to the server\_name does nothing, it  
> just adds  
> another server alias “default”.

indeed, sorry for confusion.

server {  
listen 127.0.0.1:80 default;  
server\_name localhost;  
…  
}

is the correct config then.

_rolls eyes_  
😉
