apache到nginx proxy_pass配置

时间:2014-03-02 20:41:39

标签: apache nginx proxy reverse-proxy

我想将现有的apache ProxyPass规则转换为nginx,但我不确定如何配置超时等...

我的apache规则看起来像

ProxyPass /ProcessRequest http://127.0.0.1:8080/MyApp/ProcessRequest timeout=180 KeepAlive=On

我的nginx配置如下。我创建了一个新的位置ProcessRequest,但不知道如何将等效值等于timeout = 180 KeepAlive = On

server {
        #listen   80; ## listen for ipv4; this line is default and implied
        #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

        #root /usr/share/nginx/www/uidemo;
        root /usr/share/nginx/www;
        #root /usr/share/nginx/html
        index index.html index.htm index.php;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {

                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

        }

        location /ProcessRequest {

                proxy_pass http://127.0.0.1:8080/MyApp/ProcessRequest;


        }

--- 
---

1 个答案:

答案 0 :(得分:0)

答案是:

location /ProcessRequest {
        proxy_buffering off;
        proxy_connect_timeout 180;
        proxy_send_timeout 180;
        proxy_read_timeout 180;
        proxy_buffers 8 32k;


        proxy_pass http://127.0.0.1:8080/MyApp/ProcessRequest;
    }