2012-10-11 28 views
7

Próbuję skonfigurować Nginx do rzeczy proxy na subdomenie: dev.int.comKonfiguracja Nginx z proxy_pass

Chcę dev.int.com być przekierowywane do OD: 8080 oraz dev.int. com/schować do proxy IP: 7990

Oto mój obecny plik konfiguracyjny

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; 
    } 
} 

Jednakże/stash przekierowania zamierzamy /. Co ja robię źle?

Odpowiedz

16

spróbuj tego ...

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

Cześć, jeszcze przekierowanie do/zamiast/Stash – bear

+0

Hey - Ok sprawdzić plik conf ten facet. ma dwa wpisy na serwerze, które mogą pomóc w twojej sytuacji. http://stackoverflow.com/questions/1174554/setting-up-subdomains-on-nginx –

Powiązane problemy