nginx.conf
http {
......
#balancing 负载站点 weight是权重
upstream vueServer{
server 127.0.0.1:8001 weight=1;
server 127.0.0.1:8002 weight=1;
server 127.0.0.1:8003 weight=1;
}
......
#site配置
server {
listen 80;
server_name file.xxxx.com;
charset utf-8;
#不带数据的请求,包括restful风格的请求
location / {
proxy_pass http://vueServer;
#proxy_set_header X-Forwarded-For $remote_addr;
#proxy_set_header Host $host;
}
# 静态文件,从这里获取
location ~* \.(css|gif|png|jpeg|ico|svg)$ {
#root D:/www/web1;
proxy_pass http://cdnServer;
}
# php类型的请求,从这里走
location ~ \.php$ {
proxy_pass http://phpServer;
}
}