yum install -y nginx
/etc/nginx/conf.d/fileserver.7777.conf
server {
listen 7777; # 如果希望使用 HTTPS,请改为 listen 443 ssl; 并配置 SSL 证书相关项
root /data/logs; # 指定存放共享文件的目录,例如:/srv/www/files
autoindex on; # 开启自动索引,显示目录列表
location ~* \.(txt|pdf|doc|docx|xls|xlsx|ppt|pptx|zip|rar|gz|bz2|tar|html)$ {
expires 30d; # 设置静态文件缓存过期时间为 30 天,可根据需要调整
}
}
systemctl restart nginx