配置需求:
内网192.168.80.205的机器上部署了一个Web项目,下文称web,
 
url为http://192.168.80.205:8082。
 
并且使用nginx访问图片,url格式为:
 
http://192.168.80.205:81/1.jpg
 
现需从外网访问,固定的外网ip为:123.3.2.1,并在此外网服务器使用nginx的反向代理去实现,
 
nginx.conf的基本配置项如下:
listen       123.3.2.1:89;
server_name  www.abcefg.com;
 
反向代理http://192.168.80.205:8082的配置如下:
 
#反向代理web的访问路径,此外网访问的url为:http://123.3.2.1:89
location / {
proxy_pass http://192.168.80.205:8082/;
        }
 
#反向代理图片的访问路径,注意:http://192.168.80.205:81 后面不需要“/”,否则nginx启动报错
location ~*\.(jpg)$ {
proxy_pass http://192.168.80.205:81;
        }

相关文章:

  • 2022-12-23
  • 2021-06-24
  • 2021-12-25
  • 2021-06-01
猜你喜欢
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2021-10-11
  • 2021-04-01
  • 2021-08-29
相关资源
相似解决方案