Fork me on GitHub

nginx静态资源服务器配置

 

  • 编辑 nginx.conf
        server {
                listen 80;
                server_name file.youxiu326.xin;
                location /image/ {    #访问 file.youxiu326.xin/image/*  则访问到 /java/static/image/*
                    root /java/static/;
                    autoindex on;
                }
                location /file/ {    #访问 file.youxiu326.xin/file/*  则访问到 /java/static/file/*  
                    root /java/static/;
                    autoindex on;
                }
        }

  

  • 重启nginx
[root@lihui static]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@lihui static]# nginx -s reload

  

 

posted @ 2019-03-31 10:25  youxiu326  阅读(702)  评论(0编辑  收藏  举报