Forum: NGINX Vhost problem (only last vhost works)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Kyrre N. (Guest)
on 2008-12-10 19:32
(Received via mailing list)
Hey you all, I'm trying to run 3 sites / virtual hosts:

http://pastie.org/335739

But only the last site works. The first and second redirects me to that
last site.

What have I done wrong?

Thank you.
Redd V. (Guest)
on 2008-12-10 20:34
(Received via mailing list)
Igor S. (Guest)
on 2008-12-10 21:08
(Received via mailing list)
On Wed, Dec 10, 2008 at 06:16:48PM +0100, "Kyrre Nyg?rd" wrote:

> Hey you all, I'm trying to run 3 sites / virtual hosts:
>
> http://pastie.org/335739
>
> But only the last site works. The first and second redirects me to that last site.
>
> What have I done wrong?

Are you sure that mongrel understands both variants: site1.com
and www.site1.com ?
Redd V. (Guest)
on 2008-12-10 21:29
(Received via mailing list)
On Wed, Dec 10, 2008 at 7:55 PM, Igor S. <removed_email_address@domain.invalid> 
wrote:
>
> Are you sure that mongrel understands both variants: site1.com
> and www.site1.com ?
>
>
> --
> Igor S.
> http://sysoev.ru/en/
>

Hello Igor!

I've made an attempt improving my config files:

http://pastie.org/335986

All my sites, however, get a 502 Bad Gateway (nginx/0.6.34). Any idea
what's wrong?

Thanks!
Igor S. (Guest)
on 2008-12-10 21:33
(Received via mailing list)
On Wed, Dec 10, 2008 at 08:13:00PM +0100, Redd V. wrote:

>
> Hello Igor!
>
> I've made an attempt improving my config files:
>
> http://pastie.org/335986
>
> All my sites, however, get a 502 Bad Gateway (nginx/0.6.34). Any idea
> what's wrong?

What is in error_log ?
Redd V. (Guest)
on 2008-12-10 22:28
(Received via mailing list)
On Wed, Dec 10, 2008 at 8:20 PM, Igor S. <removed_email_address@domain.invalid> 
wrote:
>
> What is in error_log ?
>
>
> --
> Igor S.
> http://sysoev.ru/en/
>

Nothing, I got rid of the Bad Gateway problem by finetuning my
mongrel_cluster files I think. Here's my latest setup:
http://pastie.org/336024

The other problem remains though. Only site 3 seems to work. When I
visit site 1 and site 2 all I see is site 3.

Thanks!
Igor S. (Guest)
on 2008-12-10 22:38
(Received via mailing list)
On Wed, Dec 10, 2008 at 09:09:20PM +0100, Redd V. wrote:

> On Wed, Dec 10, 2008 at 8:20 PM, Igor S. <removed_email_address@domain.invalid> wrote:
> >
> > What is in error_log ?
>
> Nothing, I got rid of the Bad Gateway problem by finetuning my
> mongrel_cluster files I think. Here's my latest setup:
> http://pastie.org/336024
>
> The other problem remains though. Only site 3 seems to work. When I
> visit site 1 and site 2 all I see is site 3.

When you ask site1.com and www.site1.com, in both cases you see site 3 ?
Redd V. (Guest)
on 2008-12-10 23:21
(Received via mailing list)
On Wed, Dec 10, 2008 at 9:24 PM, Igor S.
>
> When you ask site1.com and www.site1.com, in both cases you see site 3 ?
>
>
> --
> Igor S.
> http://sysoev.ru/en/
>
>

Yes, that's exactly right. Why?
Igor S. (Guest)
on 2008-12-11 10:26
(Received via mailing list)
On Wed, Dec 10, 2008 at 10:07:17PM +0100, Redd V. wrote:

> On Wed, Dec 10, 2008 at 9:24 PM, Igor S.
> >
> > When you ask site1.com and www.site1.com, in both cases you see site 3 ?
>
> Yes, that's exactly right. Why?

Are you sure that mongrels on 127.0.0.1:5000/5001/5002 are able to
recoginze different hosts ? Can you see all sites without nginx ?
Redd V. (Guest)
on 2008-12-11 11:20
(Received via mailing list)
On Thu, Dec 11, 2008 at 9:12 AM, Igor S. <removed_email_address@domain.invalid> 
wrote:
>
> Are you sure that mongrels on 127.0.0.1:5000/5001/5002 are able to
> recoginze different hosts ? Can you see all sites without nginx ?
>
>
> --
> Igor S.
> http://sysoev.ru/en/
>
>

About mongrels recognizing different hosts, I'm not really sure. My
.yml files seem just like the ones in the tutorials though.

You mean if I can see them like this?

# sockstat | grep 500
www      ruby18     34817 3  tcp4   127.0.0.1:5008        *:*
www      ruby18     34814 3  tcp4   127.0.0.1:5007        *:*
www      ruby18     34811 3  tcp4   127.0.0.1:5006        *:*
www      ruby18     34807 3  tcp4   127.0.0.1:5005        *:*
www      ruby18     34804 3  tcp4   127.0.0.1:5004        *:*
www      ruby18     34801 3  tcp4   127.0.0.1:5003        *:*
www      ruby18     34797 3  tcp4   127.0.0.1:5002        *:*
www      ruby18     34794 3  tcp4   127.0.0.1:5001        *:*
www      ruby18     34791 3  tcp4   127.0.0.1:5000        *:*
Igor S. (Guest)
on 2008-12-11 11:33
(Received via mailing list)
On Thu, Dec 11, 2008 at 10:08:08AM +0100, Redd V. wrote:

> # sockstat | grep 500
> www      ruby18     34817 3  tcp4   127.0.0.1:5008        *:*
> www      ruby18     34814 3  tcp4   127.0.0.1:5007        *:*
> www      ruby18     34811 3  tcp4   127.0.0.1:5006        *:*
> www      ruby18     34807 3  tcp4   127.0.0.1:5005        *:*
> www      ruby18     34804 3  tcp4   127.0.0.1:5004        *:*
> www      ruby18     34801 3  tcp4   127.0.0.1:5003        *:*
> www      ruby18     34797 3  tcp4   127.0.0.1:5002        *:*
> www      ruby18     34794 3  tcp4   127.0.0.1:5001        *:*
> www      ruby18     34791 3  tcp4   127.0.0.1:5000        *:*

Could you say mongrel to listen on host IP (not 127.0.0.1)
and request site1/etc directly from mongrel ?
Redd V. (Guest)
on 2008-12-11 12:00
(Received via mailing list)
On Thu, Dec 11, 2008 at 10:19 AM, Igor S. <removed_email_address@domain.invalid> 
wrote:
>
> Could you say mongrel to listen on host IP (not 127.0.0.1)
> and request site1/etc directly from mongrel ?
>
>
> --
> Igor S.
> http://sysoev.ru/en/
>

Cool, well, going to http://<ip>:5000 (which should be site 1) shows
site 3. Thanks man!
Redd V. (Guest)
on 2008-12-11 14:41
(Received via mailing list)
I think the other sites actually work. However they all use site 3's
database for some strange reason. I've checked over and over and
they're all set to use their own databases. This is probably not a
nginx issue, so I'll try my luck elsewhere. Thanks a lot though!
Timothy A. Napthali (Guest)
on 2008-12-13 01:49
(Received via mailing list)
I'm wondering if Nginx is going to get the ability to add, remove and
rewrite generic response headers?

At the moment you seem to be able to use "add_header" when the response
code is 200, 204, 301, 302 or 304 or modify the "expires" header but
what I would like to be able to do is muck about with authentication
headers. I'm trying to get Microsoft "Outlook Anywhere" (aka RPC over
HTTP) to work but one of the issues I'm having is negotiating
authentication away from NTLM (which wont work) to basic. I've seen this
done with Apache by doing response header rewrites to strip out the NTLM
stuff in a few examples.
This topic is locked and can not be replied to.