使用nginx搭建静态资源服务器

243 阅读1分钟

配置如下:

server {
    listen 7082;#监听端口
    server_name localhost;#监听域名
    charset utf-8;#指定网页的编码格式
    location /staticfile/ {
            alias /usr/share/staticfile/;
            autoindex on;
    }
}

注意:不要少了文件夹后边的/

预览效果