nginx文件服务器

岁酱吖の 提交于 2019-12-03 17:18:54
1.安装nginx:
[root@test data]#yum install nginx -y 

2.编辑配置文件:
[root@test data]#vim  /etc/nginx/nginx.conf
添加如下:
    autoindex on;                    ##显示目录
    autoindex_exact_size on;         ##显示文件大小
    autoindex_localtime on;          ##显示文件时间

    server {
        listen       80 default_server;
       # listen       [::]:80 default_server;
        server_name  _;
       # root         /usr/share/nginx/html;
         root         /data;                            

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

3.重启服务:
[root@test data]#systemctl restart nginx 

4.访问测试:

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!