http {
include mime.types;
default_type application/octet-stream;
limit_conn_zone $binary_remote_addr zone=perip:10m; #容器共使用10M的内存来对于IP传输开销
limit_conn_zone $server_name zone=perserver:10m; #总容器共使用10M的内存来对于IP传输开销
sendfile on;
keepalive_timeout 65;
upstream 目录1 {
server 127.0.0.1:8082;
}
upstream 目录2 {
server 127.0.0.1:8081;
server 127.0.0.1:8082;
}
server {
listen 8080;
server_name 192.168.3.223;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_http_version 1.1;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr:$remote_port;
proxy_set_header X-Forwarded-By $server_addr:$server_port;
}
location /目录1 {
root html;
index index.html index.htm;
limit_conn perip 200; #每个IP使用200个连接。
limit_conn perserver 1000; #目录1只能1000个连接,也是当前目录总连接1000个。
proxy_http_version 1.1;
proxy_pass http://目录1;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr:$remote_port;
proxy_set_header X-Forwarded-By $server_addr:$server_port;
}
location /目录2 {
root html;
index index.html index.htm;
limit_conn perip 20;
limit_conn perserver 100;
proxy_http_version 1.1;
proxy_pass http://目录2;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr:$remote_port;
proxy_set_header X-Forwarded-By $server_addr:$server_port;
}
阅读(2199) | 评论(1) | 转发(0) |