2013-02-26 5 views
-1

특정 URL을 다른 포트에서 실행중인 로컬 서버로 리디렉션하고 싶습니다. nginx.config에 추가해야 할 항목이 확실하지 않습니다. 감사! URI가 그대로 유지됩니다 ngnix URL 리디렉션에 대한 설정 구성

location ^~ /v1/jobs { 
    proxy_pass http://www.domain.com:9090 
    } 
사용 proxy pass

http { 

    ## 
    # Basic Settings 
    ## 

    sendfile on; 
    tcp_nopush on; 
    tcp_nodelay on; 
    keepalive_timeout 65; 
    types_hash_max_size 2048; 

    # server_names_hash_bucket_size 64; 
    # server_name_in_redirect off; 

    include /etc/nginx/mime.types; 
    default_type application/octet-stream; 

    ## 
    # Logging Settings 
    ## 

    access_log /var/log/nginx/access.log; 
    error_log /var/log/nginx/error.log;  

    ## 
    # Virtual Host Configs 
    ## 

    include /etc/nginx/conf.d/*.conf; 
    include /etc/nginx/sites-enabled/*; 
} 

답변

2

- 당신이 프록시 패스 전에 재 작성을 사용할 수 있습니다 : 아래

e.g: for url /v1/jobs 
I want to direct it to a local server running on port 9090 

내 현재의 nginx의 구성 설정입니다 필요한 경우 URI를 변경합니다.

의 nginx

  • 중 하나를 수행 nginx -s reload
  • 를 다시 시작하거나 공정 killall -HUP nginx
  • 에 HUP를 보내거나 서비스를 다시 시작하려면 service nginx restart
  • 또는 /etc/init.d/nginx restart
관련 문제