windows nginx set up a file server (plain)

In some projects there, sometimes you need to access picture time. I believe that many people are put directly into the project file inside;

Here today to tell you to build a picture of the use nginx server, direct access to the images on the disk.

Method (using a root keyword):

location /img {
    root E:/pic/; #磁盘的目录路径
    autoindex on; #是否开启目录浏览
}

ps: time of the visit he is to go to E: / pic / img directory to find. That is: it will add a layer behind the root directory / img directory

Method II (using the alias keyword):

location /img {
    root E:/pic/img; #磁盘的目录路径
    autoindex on; #是否开启目录浏览
}

ps: alias not append / img path, access / img equivalent to E: / pic / img

Finally, attach the nginx commonly used commands

Start nginx

start nginx

Reload nginx

nginx.exe -s reload

Stop nginx

nginx.exe -s stop

or

nginx.exe -s quit

Guess you like

Origin www.cnblogs.com/linhuaming/p/11823737.html