nginx 配置靜態資源配置root alias

2021-10-12 10:20:55 字數 819 閱讀 3631

#access_log  logs/access.log  main;

sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server

## 配置訪問路徑 --- alias

location /pic2/

## 配置路徑 --- root

location /pic/

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#error_page 500 502 503 504 /50x.html;

location = /50x.html

}

上面的配置檔案中存在兩個訪問的位址,但是最總的結果是只能訪問帶有alias 的檔案,root 方式配置並未生效,

如圖

導致的結果是什麼?

目前未找到。。。。難受

如果想都能用的話,還是可以都通過alias 方式進行配置,這樣的話就可以訪問資源。

Nginx靜態資源配置

1 概述 本篇博文記錄把靜態資源放到linux中搭建的nginx服務的過程。2 資源準備 2 上傳到nginx伺服器的某目錄 可以使用 3 nginx配置 1 nginx.conf檔案配置 新增兩個server模組,乙個模組對應的是乙個虛擬主機,此處採用埠和網域名稱進行區分。購物車靜態頁面 81埠,...

Django 靜態資源配置

今天我們來配置一下python下django裡的靜態資源 開發環境即設debug true static url static 3.在模板中訪問可以有三種方式 直接硬編碼像 static jpg這樣,或是使用static標籤,如 我常使用 jpg 來寫靜態路徑的 必須使用requestcontext...

SpringBoot靜態資源配置

1 springboot靜態資源配置,使用 webmvcautoconfiguration配置各種屬性。springboot 預設將 所有訪問對映到以下路徑 classpath static classpath public classpath resources classpath meta in...