nginx配置项
打开DMZ的nginx配置文件,添加如下内容:
upstream php {
server 172.16.10.32:80 weight=1 max_fails=2 fail_timeout=30s;
}
upstream java {
server 172.16.10.71:80 weight=1 max_fails=2 fail_timeout=30s;
}
upstream nodejs {
server 172.16.10.52:8842 weight=1 max_fails=2 fail_timeout=30s;
}
upstream net {
server 172.16.10.10:80 weight=1 max_fails=2 fail_timeout=30s;
}
server{
listen 80;
server_name php.1473.cn;
location / {
#auth_basic "Ristricted";
proxy_pass http://php;
proxy_set_header Host $host;
#proxy_store on;
set $a $1;
rewrite ^/(.*)$ /php/$a break;
#重写到php目录下
}
}
server{
listen 80;
server_name net.1473.cn;
location / {
#auth_basic "Ristricted";
proxy_pass http://net;
proxy_set_header Host $host;
#proxy_store on;
}
}
server{
listen 80;
server_name nodejs.1473.cn;
location / {
#auth_basic "Ristricted";
proxy_pass http://nodejs;
proxy_set_header Host $host;
#proxy_store on;
}
}
server{
listen 80;
server_name java.1473.cn;
location / {
#auth_basic "Ristricted";
proxy_pass http://java;
proxy_set_header Host $host;
#proxy_store on;
set $a $1;
rewrite ^/(.*)$ /api/java$a break;
#根据自己地址填写
}
}