favicon-api-v3/nginx.conf

30 lines
962 B
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 支持伪静态
rewrite ^/icon/(.*)\.png$ /icon/?url=$1;
# 反向代理配置
location /icon/
{
proxy_pass http://127.0.0.1:8001;
proxy_http_version 1.1;
## Proxy headers
proxy_set_header Upgrade $http_upgrade;
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 REMOTE-HOST $remote_addr;
proxy_set_header remote_addr $remote_addr;
proxy_set_header X-Proto $scheme;
## Proxy timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
# 后端返回错误时跳转到指定url
proxy_intercept_errors on;
error_page 400 404 408 500 502 503 504 /favicon.png;
add_header X-Cache $upstream_cache_status;
add_header Access-Control-Allow-Origin *;
}