windows下使用nginx配置静态资源

nginx启动命令:start nginx

nginx停止命令:nginx -s stop 或 nginx -s quit

进入nginx的conf目录下,打开nginx.conf并配置

	server{
		listen    8081; #访问地址http://localhost:8081/img/1.png
		server_name localhost;
		location / {
		  root  html;
		  index index.html index.htm;
		}
		location /img/ {# img必须在D:/test目录下
		  root  D:/test;
		  autoindex on;
		}
	}

打开网址即可访问

猜你喜欢

转载自blog.csdn.net/Json_Marz/article/details/108423470
今日推荐