码迷,mamicode.com
首页 > 其他好文 > 详细

使用Nginx配置资源虚拟路径

时间:2016-04-24 12:23:26      阅读:463      评论:0      收藏:0      [点我收藏+]

标签:

nginx.conf文件主要内容如下

 
    upstream myhost {  
       server localhost:8080 weight=6;  #权重,我这里随便写的
       server localhost:8091 weight=4;  
    } 

    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
            proxy_pass http://myhost;

        }
	location /res/ {
	    alias   D:/pic/;
	}

D:/pic/目录下是我图片路径,例如D:/pic/下有一张名为 100.jpg的图片,现在只需要访问http://localhost/res/110.jpg就可以访问到图片。

使用Nginx配置资源虚拟路径

标签:

原文地址:http://www.cnblogs.com/jimmy-muyuan/p/5426515.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!