CentOS 快速搭建文件服务器

2021-05-15  本文已影响0人  LiangLliu

CentOS 快速搭建文件服务器

CentOS 快速搭建文件服务器

1、安装nginx

sudo yum install epel-release
sudo yum install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl status nginx
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

2、配置Nginx代理的文件目录

/etc/nginx/conf.d/*
vim /etc/nginx/conf.d/file_server.conf
server {
  listen 9009; # 你想要代理的端口
  server_name 10.0.0.1; # 自己PC的ip或者服务器的域名 charset utf-8; # 避免中文乱码 
  root /var/www/files; # 存放文件的目录 
  location / { 
    autoindex on; # 索引 
    autoindex_exact_size on; # 显示文件大小 
    autoindex_localtime on; # 显示文件时间 
  }
}
sudo service nginx reload

3、访问文件服务

上一篇 下一篇

猜你喜欢

热点阅读