我需要使用php-fpmconfigurationdynamic设置PHP会话cookie域,伪代码如下所示:
<If "%{HTTP_HOST} !~ /[0-9]/"> php_value[session.cookie_domain] = ".mysite.com" </If>
<If>指令在Apacheconfiguration中工作。 但是,我需要这个在www.conf ,它看起来像一个php.ini文件。 怎么做?
第一步:查看PHP-FPM池(例如: http : //blog.chrismeller.com/configuring-and-optimizing-php-fpm-and-nginx-on-ubuntu-or-debian )
第二步:您可以为您托pipe的每个域创build一个php-fpm池(例如mysite.com)
In PHP-FPM config: ----------------- Copy “www” pool config file (www.conf located in /etc/php5/fpm/pool.d/ on my system) saving it as mysite.conf and changing: - the [www] label at the top of the file to [mysite] - the port in the “listen” directive to 9001 (from the deault of 9000) - add a new line: php_value[session.cookie_domain] = ".mysite.com"
第三步:在Nginx中为新网站创build一个新的监听器(mysite.com)
In Nginx config: ---------------- Create a new vhost for mysite.com. and send PHP requests via port 9001 rather than the default port 9000
第四步:重启PHP-FPM(在我的系统上:/etc/init.d/php-fpm restart)和Nginx(在我的系统上:/etc/init.d/nginx restart)
积分转到: https : //thedotproduct.org/setting-or-overriding-php-configuration-in-php-fpm-pool-configurations/