Nginx作为文件服务器

配置fileserver.conf

server {

listen      1234;

server_name  192.168.0.240;

#charset koi8-r;

#ccess_log  logs/host.access.log  main;

charset utf-8; # 避免中文乱码

root E:/FTP_ROOT; # 存放文件的目录

location / {

autoindex on; # 索引

autoindex_exact_size off; # 显示文件大小。如果为on,则显示文件的原始大小(bytes)

autoindex_localtime on; # 显示文件时间

}

error_page  404 /404.html;

location = /404.html {

root  html;

}

# redirect server error pages to the static page /50x.html

#

error_page  500 502 503 504 /50x.html;

location = /50x.html {

root  html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

#    proxy_pass  http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

#location ~ \.php$ {

#    root          html;

#    fastcgi_pass  127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

#    deny  all;

#}

}

查看效果

Nginx作为文件服务器_第1张图片
效果图

你可能感兴趣的:(Nginx作为文件服务器)