nginx 簡單配置

2021-08-15 07:59:29 字數 350 閱讀 4654

server

#檔案快取

#js/css檔案快取

location ~ .*\.(js|css)?$

不把css/js/image相應的資源檔案寫入快取,會導致資源檔案404,無法被訪問。至於快取的時間長短可以自己設定。

在nginx的location和配置中location的順序沒有太大關係。與location表示式的型別有關。相同型別的表示式,字串長的會優先匹配。

如果80埠被暫用或者不想使用80埠作為nginx預設埠,可以修改 listen  80值。瀏覽器訪問

如:

簡單配置nginx

在mac下配置nginx 1,安裝 brew install nginx 2,啟動nginx 在終端鍵入 nginx 回車 3,在瀏覽器裡輸入localhost 8080 出現welcome to nginx 說明成功 安裝 nginx v 檢視版本號 4 cd usr local etc ngin...

nginx簡單配置

nginx.conf root html 目錄 通過官方檢視模組幫助 client body temp conf fastcgi.conf 動態配置 fastcgi.conf.default fastcgi params 引數 fastcgi params.default koi utf koi w...

Nginx簡單配置

一 屬性說明 1.remote addr 與 http x forwarded for 用以記錄客戶端的 ip 位址 2.remote user 用來記錄客戶端使用者名稱 3.time local 用來記錄訪問時間與時區 4.request 用來記錄請求的 url 與 http 協議 5.statu...