目的:
- Nginx监听80端口,访问 www.test.com/edu ,转发到端口为8002的tomcat中,访问 www.test.com/vod 转发到端口为8001的tomcat中。
Nginx的server配置如下
server {
listen 80;
server_name www.qrcode.com;
location ~ /edu/ {
proxy_pass http://127.0.0.1:8002;
}
location ~ /vod/ {
proxy_pass http://127.0.0.1:8001;
}
}
location 指令说明
该指令用于匹配 URL。
语法如下:
location [ = | ~ | ~* | ^~] uri {
}