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路径上去做请求.

分类:

技术点:

相关文章:

  • 2021-08-26
  • 2022-01-10
  • 2021-04-18
  • 2021-08-15
  • 2021-10-17
猜你喜欢
  • 2021-10-11
  • 2021-04-24
  • 2021-08-06
  • 2021-06-11
  • 2021-12-10
  • 2021-12-07
相关资源
相似解决方案