Windows 利用Nginx搭建文件服务器

snginx.conf

http {
include mime.types;
default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
    autoindex on;             #开启索引功能
        autoindex_exact_size off; # 关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb)
        autoindex_localtime on;   # 显示本机时间而非 GMT 时间
        charset utf-8; # 避免中文乱码

        root   html;
        index  index.html index.htm;
    }

location /static {

        alias   C:\static;

        allow all;

        autoindex on;             #开启索引功能
        autoindex_exact_size off; # 关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb)
        autoindex_localtime on;   # 显示本机时间而非 GMT 时间
        charset utf-8; # 避免中文乱码


    }

   
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

 

   
}
发布了3 篇原创文章 · 获赞 1 · 访问量 1071

猜你喜欢

转载自blog.csdn.net/weixin_43552513/article/details/104512396