nginx 静态资源访问配置


 server {
        listen 443;
        server_name localhost;
        ssl on;
# 此处可配置域名访问,默认的首页

#       root html;   #目录
#       index weixin/index.html;

#       rewrite ^/ https://www.baidu.com  


#       location / {
#               root html;
#               index index.html index.htm;
#       }

# 配置所有的静态资源访问路径
        location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
        {
                root html/weixin;   #目录
                index index.html;
                #expires定义用户浏览器缓存的时间为1天,如果静态页面不常更新,可以设置更长,这样可以节省带宽和缓解服务器的压力
                expires      1d;
        }

    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM