带有fastcgi_param的Nginx缓存其他虚拟主机的值

时间:2013-11-12 14:26:03

标签: nginx fastcgi

当我尝试在我的一个虚拟主机中自动预配文件时,我认为它由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;
    }
}

0 个答案:

没有答案