找到nginx配置文件
vi /etc/nginx/nginx.conf
在http{}中加入
server{
#监听80端口
listen 80;
#请求的域名
server_name www.xxx.cn;
#所有www.xxx.cn/下的请求都代理到http://127.0.0.1:8080
location / {
proxy_pass http://127.0.0.1:8080;
}
#所有www.xxx.cn/mp下的请求都代理到http://127.0.0.1:8080/mp
location /mp{
proxy_pass http://127.0.0.1:8080/mp;
}
}
location /xxxxxx.txt {
root /usr/;
}
root 配置的意思是,会在root配置的目录后跟上URL,组成对应的文件路径。