034 通过域名访问服务器或本地的图片资源---switchhost+nginx

1.修改host解析

 

2.使用Nginx代理,实现域名访问

进入Nginx的安装路径E:\toolsoftware\nginx-1.14.0\nginx-1.14.0\conf,修改

添加如下内容:

server {
        listen       80;
        server_name  image.leyou.com;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location / {
            root C:\\Users\\image;
        }
    }

范例:

重新加载Nginx

3.访问测试

浏览器输入:http://image.leyou.com/images/4/11/1524297413085.jpg

posted @ 2019-09-29 10:22  雨后观山色  阅读(1007)  评论(0编辑  收藏  举报