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