lvgo

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

进入到nginx目录下,打开nginx.conf

http {
    server {
            listen 80;
            server_name example.com;

            location /test1 {
                    proxy_pass http://example.com:8080/test1;
            }

            location /test2 {
                    proxy_pass http://example.com:8081/test2;
            }

            location / {
                    proxy_pass http://example.com;
            }
    }
}

重新加载一下配置文件

./nginx -s reload

最主要的地方就是配置好location的地址

当我们输入域名之后加上/test1的时候,就会被nginx映射到我们域名:8080/test1路径上去做请求.
posted on 2018-07-20 21:28  星尘的一个朋友  阅读(1063)  评论(0编辑  收藏  举报