码迷,mamicode.com
首页 > 其他好文 > 详细

使用nginx快速搭建文件服务器

时间:2018-12-21 15:19:44      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:png   com   html   res   安装完成   cal   div   nginx配置文件   访问   

准备工作:

关闭防火墙 systemctl stop firewalld && systemctl disable firewalld

禁用selinux setenforce 0 ----临时关闭

                 sed -i "s/SELINUX=enforcing/SELINUX=Disabled/g" /etc/selinux/config

安装nginx:

yum install nginx -y

  安装完成后,验证nginx页面可以访问

技术分享图片

 

 

设置nginx文件服务器:

  首先需要查看nginx是通过哪个配置文件启动

   nginx -h

 技术分享图片

 修改nginx配置文件:

  vim /etc/nginx/nginx.conf 添加内容如下:

        root         /usr/share/nginx/html    #文件存放的位置
        autoindex on;                               #开启索引功能 
        autoindex_exact_size off;  # 关闭计算文件确切大小(单位bytes),只显示大概大小(kb mb gb)
        autoindex_localtime on;   # 显示本机时间而非 GMT 时间

 技术分享图片

:wq 保存并退出

重启nginx 

systemctl restart nginx 

登陆ip:8080

技术分享图片

显示这个说明已经安装成功了!!!

 

使用nginx快速搭建文件服务器

标签:png   com   html   res   安装完成   cal   div   nginx配置文件   访问   

原文地址:https://www.cnblogs.com/king-LL/p/10155026.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!