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;
}
}
打开网址即可访问