unbuntu下nginx简单的配置反向代理

找到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,组成对应的文件路径。

发布了77 篇原创文章 · 获赞 21 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/f1370335844/article/details/102566824