2012-10-11 24 views
7

Estoy intentando configurar Nginx a la materia de proxy en un subdominio: dev.int.comConfigurar Nginx con PROXY_PASS

Quiero dev.int.com a por proxy a IP: 8080, y dev.int. com/esconder a ser proxy de IP: 7990

Aquí está mi archivo actual configuración

server { 
listen 80; 
server_name dev.int.com; 
access_log off; 
location/{ 
    proxy_pass http://IP:8080; 
    proxy_set_header Host   $host; 
    proxy_set_header X-Real-IP  $remote_addr; 
    proxy_set_header X-Forwarded-for $remote_addr; 
    port_in_redirect off; 
    proxy_redirect http://IP:8080/jira /; 
    proxy_connect_timeout 300; 
    location ~ ^/stash { 
     proxy_pass http://IP:7990; 
     proxy_set_header Host   $host; 
     proxy_set_header X-Real-IP  $remote_addr; 
     proxy_set_header X-Forwarded-for $remote_addr; 
     port_in_redirect off; 
     proxy_redirect http://IP:7990/ /stash; 
     proxy_connect_timeout 300; 
    } 
} 

    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
    root /usr/local/nginx/html; 
    } 
} 

Sin embargo,/redirecciones alijo van a /. ¿Qué estoy haciendo mal?

Respuesta

16

seguirlo ...

server { 
    listen 80; 
    server_name dev.int.com; 
    access_log off; 
    location/{ 
     proxy_pass http://IP:8080; 
     proxy_set_header Host   $host; 
     proxy_set_header X-Real-IP  $remote_addr; 
     proxy_set_header X-Forwarded-for $remote_addr; 
     port_in_redirect off; 
     proxy_redirect http://IP:8080/jira /; 
     proxy_connect_timeout 300; 
    } 

    location ~ ^/stash { 
     proxy_pass http://IP:7990; 
     proxy_set_header Host   $host; 
     proxy_set_header X-Real-IP  $remote_addr; 
     proxy_set_header X-Forwarded-for $remote_addr; 
     port_in_redirect off; 
     proxy_redirect http://IP:7990/ /stash; 
     proxy_connect_timeout 300; 
    } 

    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
     root /usr/local/nginx/html; 
    } 
} 
+0

Hola, todavía volver a dirigir a/en lugar de/alijo – bear

+0

Hey - Ok echa un vistazo a archivo de configuración de este tipo. él tiene dos entradas de servidor que podrían ayudar a resolver su situación. http://stackoverflow.com/questions/1174554/setting-up-subdomains-on-nginx –

Cuestiones relacionadas