使用nginx可以搭建简单文件服务器
安装nginx(不详述)
修改配置文件
/usr/local/nginx/conf/nginx.conf
user root; worker_processes 1; #error_log logs/error.log; #pid logs/nginx.pid; events { worker_connections 1024; } 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; keepalive_timeout 65; include ./conf.d/*.conf; }
文件配置文件
autoindex on;# 显示目录 autoindex_exact_size on;# 显示文件大小 autoindex_localtime on;# 显示文件时间 server { listen 80; server_name 172.16.90.13; root /data/file; }
创建根目录文件夹并且放入几个文件
web页面访问查看,单击文件即可下载