nginx 访问静态图片

1.nginx设置 nginx.conf2

   server {
        listen       8881;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
			
        }
        
        // 本地访问图片
        location  /map/ {
            alias  D:/A-Software/MapTileDownloader/map/mapabc/satellite/; 
            autoindex on;
        }
		
    }

我的本地图片地址如图: 

nginx 访问静态图片_第1张图片 

 

2.启动nginx 

3.访问: http://localhost:8881/map/图片其他路径

例如:http://localhost:8881/map/14/13517/6393.jpg

nginx 访问静态图片_第2张图片

 备注:如果404

1.在 任务管理器中 彻底关闭 nginx ,然后重启

2.alias 设置,最后一定要有/ 

你可能感兴趣的:(nginx,运维,服务器)