一、部署静态资源
1、配置文件
location / {
root D:\\code\\test-nginx\\www;
index index.html index.htm;
}
1.1、alias配置静态资源
location /imgs/ {
alias D:\\code\\test-nginx\\imgs\\; ## 最后需要加\\ 默认去D:\\code\\test-nginx\\imgs\\里面找文件
}
1.2、root配置静态资源
location /images/ {
root D:\\code\\test-nginx\\test; ## 会去D:\\code\\test-nginx\\test\\images里面去找文件
autoindex on;
}
二、负载均衡
1、配置文件
---http
upstream myServer {
server 192.168.31.39:8081 weight=1;
server 192.168.31.39:8082 weight=1;
}
---server
location /test/ {
proxy_pass http:
}
三、反向代理
1、配置文件
location /other/ {
proxy_pass http:
}