利用nginx搭建文件服务器

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_36485376/article/details/83050629

前提:nginx已安装

如果还没有安装,可以参考:https://blog.csdn.net/weixin_36485376/article/details/83050513

配置Nginx

nginx.conf如下配置

server {
        listen       8090;
        server_name  localhost;
        charset utf-8;
        # 配置文件在服务器上的路径
        root /home/nginx/picture;
        # location指令用来映射请求到本地文件系统
        location / {
            autoindex on;
            autoindex_exact_size on;
            autoindex_localtime on;
        }

重启Nginx

/usr/local/nginx/sbin/nginx -s reload

验证

访问nginx服务,就能看到文件列表了
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_36485376/article/details/83050629