---
title: "nginx 代理配置"
author: "beiqi"
date: "2015-04-02T09:26:51Z"
tags: []
categories: ["企业架构"]
slug: "nginx"
draft: false
lastmod: "2015-06-19T09:20:16Z"
id: 2198018
url: "https://beiqi.iteye.com/blog/2198018"
---

worker\_processes  1;

events {  
    worker\_connections  1024;  
}

http {  
    include       mime.types;  
    default\_type  application/octet-stream;

    sendfile        on;  
    keepalive\_timeout  65;

    upstream backend {  
       server localhost:8080;  
       server localhost:8081;  
      # ip\_hash;  
    }

    server {  
        listen       80;  
        server\_name  192.168.10.24;

        location / {  
            root   html;  
            index  index.html index.htm;  
        }  
         location /sdk {  
                proxy\_pass [http://backend/app](http://backend/sdk);  
                proxy\_redirect off;  
                proxy\_set\_header Host $host;  
                proxy\_set\_header X-Real-IP $remote\_addr;  
                proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
                proxy\_next\_upstream error timeout invalid\_header http\_500 http\_502 http\_503 http\_504;  
                proxy\_max\_temp\_file\_size 0;  
                proxy\_connect\_timeout 90;  
                proxy\_send\_timeout 90;  
                proxy\_read\_timeout 90;  
                proxy\_buffer\_size 4k;  
                proxy\_buffers 4 32k;  
                proxy\_busy\_buffers\_size 64k;  
                client\_max\_body\_size    100m;

         }  
         }

        error\_page   500 502 503 504  /50x.html;  
        location = /50x.html {  
            root   html;  
        }

     }