nginx start command: start nginx
nginx stop command: nginx -s stop or nginx -s quit
Enter the conf directory of nginx, open nginx.conf and configure
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;
}
}
Open the URL to access