nginx 的動靜分離配置(tomcat)

2021-08-19 21:22:45 字數 496 閱讀 5900

nginx+tomcat是想動靜分離配置

首先在nginx的配置檔案中新增tomcat的的集群配置

upstream tomcats

這裡的演算法自己定義

location proxy_set_header $hostproxy_set_header xrealip $remote_addrproxy_set_header remotehost $remote_addrproxy_set_header xforwardedfor;:

靜態資源分離配置

#所有js,css相關的靜態資源檔案的請求由nginx處理

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

#所有等多**相關靜態資源檔案的請求由nginx處理

nginx動靜分離配置 Nginx動靜分離

動靜分離,就是將jsp servlet等動態資源交由tomcat或其他web伺服器處理,將css js image等靜態資源交由nginx或其他http伺服器處理,充分發揮各自的優勢,減輕其他伺服器的壓力,搭建更為高效的系統架構。nginx動靜分析的實現 下面要搭建nginx,環境中有三颱nginx...

Nginx配置動靜分離

配置nginx動靜分離 1.修改nginx配置檔案 location php 2.編寫測試指令碼 vim usr local nginx html test1 php php i this is a test page echo i 測試 firefox 192.168.4.5 test.php 若...

nginx 配置動靜分離

不想說話,直接上 可能真的是我菜,不然也不會覺得處處是坑,坑坑要命 動靜分離之前 狐火瀏覽器 動靜分離之後 注 我自己是這麼判斷動靜分離的效果的 接下來步入正題 這是我liunx下面的靜態資源路徑 這是我windows下面的靜態資源路徑 動靜分離 location gif jpg jpeg png ...