Vhost problem (only last vhost works)

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.

http://articles.slicehost.com/2008/1/16/ubuntu-gutsy-nginx-vhosts-rails-and-mongrels

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 ?

On Wed, Dec 10, 2008 at 7:55 PM, Igor S. [email protected] 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!

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 ?

On Wed, Dec 10, 2008 at 09:09:20PM +0100, Redd V. wrote:

On Wed, Dec 10, 2008 at 8:20 PM, Igor S. [email protected] 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 ?

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 ?

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?

On Wed, Dec 10, 2008 at 8:20 PM, Igor S. [email protected] 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!

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 ?

On Thu, Dec 11, 2008 at 9:12 AM, Igor S. [email protected] 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 :

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!

On Thu, Dec 11, 2008 at 10:19 AM, Igor S. [email protected] 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://:5000 (which should be site 1) shows
site 3. Thanks man!

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.