一、配置网关服务器
开器被代理的服务器的防火墙
?在代理服务里配置
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#配置多台服务器
upstream yaya{
server 192.168.200.131:80 weight=7 down;
server 192.168.200.132:80 weight=2 down;
server 192.168.200.133:8080 weight=2 ;
}
server {
listen 80;
server_name localhost;
location /demo {
#配置伪静态访问地址
# rewrite ^/([0-9]+).html$ /index.jsp?pageNum=$1 break;
#代理到服务器
proxy_pass http://yaya;
}
#使用正则表达式
location ~*/(images|js) {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
|