2

当我尝试在我的一个虚拟主机中自动添加一个文件时,我认为它被 FastCGI 缓存并在另一个虚拟主机上使用。第一个代码块是我的一个网站自动添加文件:

server {
    listen 80;
    server_name www.site1.com;

    root /var/www/site1;
    index index.php;

    # use fastcgi for all php files
    location ~ \.php$
    {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PHP_VALUE "auto_prepend_file=/file.php";
            include fastcgi_params;
    }
}

第二个站点不会自动添加文件,但如果在 site2 之前以任何方式请求 site1,则无论如何都会这样做。似乎两个站点都以某种方式缓存了“fastcig_param PHP_VALUE”。

server {
    listen 80;
    server_name www.site2.com;

    root /var/www/site2;
    index index.php;

    # use fastcgi for all php files
    location ~ \.php$
    {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
}
4

0 回答 0