小编Aur*_*ris的帖子

Nginx 缓存符号链接

我的 Web 服务器上有一个部署系统,每次部署应用程序时,它都会创建一个新的带时间戳的目录,并将“当前”符号链接到新目录。这一切在 apache 上都运行良好,但在我设置的新 nginx 服务器上,看起来正在运行来自“旧”部署的脚本而不是新的符号链接脚本。

我已经阅读了一些关于如何解决这个问题的教程和帖子,但没有太多信息,似乎没有任何效果。这是我的 vhost 文件:

server {
    listen 80;

    server_name ~^(www\.)?(?<sname>.+?).testing.domain.com$;
    root /var/www/$sname/current/public;
    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~* \.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js) {
        add_header        Cache-Control public;
        add_header        Cache-Control must-revalidate;
        expires           7d;
    }

    location ~ \.php$ {
        #fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        include fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
    }

    location ~ /\.ht {
        deny all;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的 fastcgi_params:

fastcgi_param   SCRIPT_FILENAME         $document_root$fastcgi_script_name;
fastcgi_param   QUERY_STRING        $query_string;
fastcgi_param   REQUEST_METHOD …
Run Code Online (Sandbox Code Playgroud)

nginx cache php-fpm php7

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

标签 统计

cache ×1

nginx ×1

php-fpm ×1

php7 ×1