天天看点

nginx-windows搭建文件服务器

1.首先你需要去http://nginx.org/en/download.html 下载 nginx安装包 我这边选择的版本是nginx/Windows-1.14.2

2.下载好之后 解压文件夹找到conf 中的 nginx.conf文件

nginx-windows搭建文件服务器

3.打开配置文件 复制下面代码 alias对应的是C:/test文件夹(用来存放文件) /demo也就是接下来的访问路径

worker_processes  1;
 
events {
    worker_connections  1024;
}
 
 
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       8054;
        server_name  localhost;
 
        location / {
            root   html;
            index  index.html index.htm;
        }
    
    location /demo {
        alias   C:\test;
            allow all;
            autoindex on;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
       
    }
}      

继续阅读