安裝了purge後,也確定purge的套件有加載進nginx裡面,但配置nginx反代理後,經過測試呈現404,稍微Google了一下,也無法解決,不曉得大家有沒有遇到類似的狀況
nginx反代理配置
upstream proxy {
server 172.16.16.8:80;
}
proxy_cache_path /var/cache/proxy/
levels=1:2 keys_zone=proxy:10m
max_size=1g inactive=1h;
server {
listen 80 default;
server_name www.scott.com;
access_log /var/log/nginx/proxy.access.log;
error_log /var/log/nginx/proxy.error.log;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location / {
proxy_pass http://proxy;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_cache proxy;
proxy_cache_key $uri$is_args$args;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
location ~ /purge(/.*) {
proxy_cache_purge proxy$1$is_args$args;
}
}
}
nginx源端配置
server {
listen 80; #port
server_name www.scott.com; #域名
root /usr/share/nginx/html/web; #路徑
index index.html; #第一個開啟位置
}
測試方式
呈現結果是 ...
404 Not Found
nginx/1.16.1