Welcome! Log In Create A New Profile

Advanced

need help with nginx as reverse proxy

Posted by cantabile 
need help with nginx as reverse proxy
July 04, 2010 06:47AM
Hi all,

here's my setup :

I have a (virtual) apache server at 192.168.150.128. This server has 2 VH, defined with the same port ( *:80) but different paths. www.exemple1.com has /var/www/exemple1 for DocumentRoot and www.exemple2.com has /var/www/exemple2.

I can access these without any problem.

Now the problem is with my nginx setup. I have another virtual server, running nginx, that I intend to use as a reverse proxy.
In my sites-available/default, I created 2 hosts with a proxy_pass written like that :

[code]
server {
listen 80;
server_name www.exemple1.com;
#set your default location
location / {
proxy_pass http://192.168.150.128/;
}
}
server {
listen 80;
server_name www.exemple2.com;
#set your default location
location /exemple2{
proxy_pass http://192.168.150.128/exemple2/;
}
}
[/code]
Now, in my hosting machines, I have set this in /etc/hosts:

www.exemple1.com 192.168.150.129 exemple1 (#nginx IP)
www.exemple2.com 192.168.150.129 exemple2 (#nginx IP)

Well, www.exemple1 work but I have a 404/NotFound when I try to access exemple2.
It must be something stupid but I cant spot the problem.
Could you help me with this ?

Thanks !
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready