小编Oli*_*nce的帖子

如何在其他 nginx 服务器面前使 nginx 反向代理缓存无效?

我在单个 IP 地址上运行 Proxmox 服务器,它将根据请求的主机向容器发送 HTTP 请求。

我在 Proxmox 端使用 nginx 来监听 HTTP 请求,我proxy_pass在不同server块中使用指令根据server_name.

我的容器在 Ubuntu 上运行,同时也在运行一个 nginx 实例。

我在完全静态的特定网站上缓存时遇到问题:在文件更新后,nginx 继续为我提供陈旧的内容,直到我:

  • 清除 /var/cache/nginx/ 并重启 nginx
  • proxy_cache off为此服务器设置并重新加载配置

这是我的配置的详细信息:

在服务器上(proxmox):

/etc/nginx/nginx.conf

user www-data;
worker_processes 8;
pid /var/run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
    use epoll;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    #tcp_nopush on;
    tcp_nodelay on;
    #keepalive_timeout 65;
    types_hash_max_size 2048;
    server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off; …
Run Code Online (Sandbox Code Playgroud)

nginx cache reverse-proxy

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

cache ×1

nginx ×1

reverse-proxy ×1