【问题标题】:How to avoid the cache of symlinks in an NGINX reverse proxy?如何避免 NGINX 反向代理中的符号链接缓存?
【发布时间】:2021-06-24 02:01:19
【问题描述】:

在 FastCGI 服务器中,我曾经将包含最新代码的文件夹符号链接到 current 文件夹,以实现零停机部署。

我使用这些指令来避免符号链接的缓存:

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;

但是现在我在一个反向代理中并且符号链接被缓存了,所以当前正在运行的代码不再是最新的。

有没有办法避免 NGINX 反向代理中的符号链接缓存?

提前感谢您的帮助,NGINX 配置如下所示:

location @octane  {
    set $suffix "";

    if ($uri = /index.php) {
        set $suffix ?$query_string;
    }

    proxy_http_version 1.1;
    proxy_set_header Host $http_host;
    proxy_set_header Scheme $scheme;
    proxy_set_header SERVER_PORT $server_port;
    proxy_set_header REMOTE_ADDR $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;

    proxy_pass http://127.0.0.1:8000$suffix;
}

【问题讨论】:

  • 看看选项 proxy_no_cache 和 proxy_cache_bypass

标签: nginx proxy reverse-proxy symlink fastcgi


【解决方案1】:

由于 NGINX 只与反向代理符号链接的端口通信,因此不应影响这方面的事情。您使用的是什么部署系统?正如我所期望的那样,停止以前的 Octane 服务器构建 (php artisan octane:stop) 并使用 php artisan octane:start 加载新构建

【讨论】:

    猜你喜欢
    • 2019-06-05
    • 1970-01-01
    • 1970-01-01
    • 2011-06-27
    • 2020-11-02
    • 2016-11-11
    • 2015-07-02
    • 2013-09-09
    • 2019-07-13
    相关资源
    最近更新 更多