Nginx之使用nginx搭建简单的文件服务器

  使用nginx可以搭建简单文件服务器

  安装nginx(不详述)  

  修改配置文件

1
/usr/local/nginx/conf/nginx.conf

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}

 

  文件配置文件

1
2
3
4
5
6
7
8
9
10
autoindex on;# 显示目录
autoindex_exact_size on;# 显示文件大小
autoindex_localtime on;# 显示文件时间
charset utf-8,gbk;#如果包含中文文件夹需要加此配置否则乱码
server {
    listen       80;
    server_name  172.16.90.13;
    root         /nas/nas/ftp/;
}
~           

  注意:以上配置内容放置在server模块内

  创建根目录文件夹并且放入几个文件

  web页面访问查看,单击文件即可下载

 

posted @   minseo  阅读(254)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示