Nginx Configurations


反向代理静态文件,处理 404,返回默认图片


接管请求,转发到其他服务器(图像资源),如果后端文件不存返回 404 错误,则返回本地配置的 default.png

server {
    listen 80;
    server_name your_server_name;

    location ^~ /logo {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://192.168.100.101:20000/statics/upload/logos;
        
    proxy_intercept_errors on;
    error_page 404 =200 /default.png;
    }   

    location = /default.png {
        root html;
    }
}