Commit 2d4a4c97 authored by omega8cc's avatar omega8cc

Issue #1635622 by anarcat - Default nginx config doesn't talk to the default...

Issue #1635622 by anarcat - Default nginx config doesn't talk to the default php-fpm config in Debian Wheezy and sid.
parent 23281f75
......@@ -3,6 +3,10 @@ $nginx_config_mode = drush_get_option('nginx_config_mode');
if (!$nginx_config_mode && $server->nginx_config_mode) {
$nginx_config_mode = $server->nginx_config_mode;
}
$phpfpm_mode = drush_get_option('phpfpm_mode');
if (!$phpfpm_mode && $server->phpfpm_mode) {
$phpfpm_mode = $server->phpfpm_mode;
}
?>
#######################################################
<?php if ($nginx_config_mode == 'extended'): ?>
......@@ -66,7 +70,11 @@ location = /cron.php {
allow 127.0.0.1;
deny all;
try_files $uri =404;
<?php if ($phpfpm_mode == 'port'): ?>
fastcgi_pass 127.0.0.1:9000;
<?php else: ?>
fastcgi_pass unix:/var/run/php5-fpm.sock;
<?php endif; ?>
}
###
......@@ -394,7 +402,11 @@ location ~* /(?:modules|libraries)/(?:contrib/)?(?:ad|tinybrowser|f?ckeditor|tin
return 403;
}
try_files $uri =404;
<?php if ($phpfpm_mode == 'port'): ?>
fastcgi_pass 127.0.0.1:9000;
<?php else: ?>
fastcgi_pass unix:/var/run/php5-fpm.sock;
<?php endif; ?>
}
###
......@@ -544,7 +556,11 @@ location = /index.php {
tcp_nopush off;
keepalive_requests 0;
try_files $uri =404; ### check for existence of php file first
<?php if ($phpfpm_mode == 'port'): ?>
fastcgi_pass 127.0.0.1:9000;
<?php else: ?>
fastcgi_pass unix:/var/run/php5-fpm.sock;
<?php endif; ?>
###
### Use Nginx cache for all visitors.
###
......@@ -583,7 +599,11 @@ location ~* ^/(?:index|cron|boost_stats|update|authorize|xmlrpc)\.php$ {
keepalive_requests 0;
access_log off;
try_files $uri =404; ### check for existence of php file first
<?php if ($phpfpm_mode == 'port'): ?>
fastcgi_pass 127.0.0.1:9000;
<?php else: ?>
fastcgi_pass unix:/var/run/php5-fpm.sock;
<?php endif; ?>
}
###
......
......@@ -21,6 +21,7 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
$this->server->setProperty('nginx_is_modern', FALSE);
$this->server->setProperty('nginx_has_gzip', FALSE);
$this->server->setProperty('provision_db_cloaking', TRUE);
$this->server->setProperty('phpfpm_mode', 'port');
}
function save_server() {
......@@ -52,6 +53,16 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
$this->server->nginx_config_mode = 'extended';
drush_log(dt('Extended Nginx Config Active -SAVE- NO control file found @path.', array('@path' => $nginx_config_mode_file)));
}
// Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
if (provision_file()->exists('/var/run/php5-fpm.sock')->status()) {
$this->server->phpfpm_mode = 'socket';
drush_log(dt('PHP-FPM unix socket mode detected -SAVE- YES socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
else {
$this->server->phpfpm_mode = 'port';
drush_log(dt('PHP-FPM port mode detected -SAVE- NO socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
}
function verify_server_cmd() {
......@@ -84,6 +95,16 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
drush_log(dt('Extended Nginx Config Active -VERIFY- NO control file found @path.', array('@path' => $nginx_config_mode_file)));
}
// Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
if (provision_file()->exists('/var/run/php5-fpm.sock')->status()) {
$this->server->phpfpm_mode = 'socket';
drush_log(dt('PHP-FPM unix socket mode detected -VERIFY- YES socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
else {
$this->server->phpfpm_mode = 'port';
drush_log(dt('PHP-FPM port mode detected -VERIFY- NO socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
// Call the parent at the end. it will restart the server when it finishes.
parent::verify_server_cmd();
}
......
......@@ -40,6 +40,7 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
$this->server->setProperty('nginx_is_modern', FALSE);
$this->server->setProperty('nginx_has_gzip', FALSE);
$this->server->setProperty('provision_db_cloaking', TRUE);
$this->server->setProperty('phpfpm_mode', 'port');
}
function save_server() {
......@@ -71,6 +72,16 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
$this->server->nginx_config_mode = 'extended';
drush_log(dt('Extended Nginx Config Active -SAVE- NO control file found @path.', array('@path' => $nginx_config_mode_file)));
}
// Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
if (provision_file()->exists('/var/run/php5-fpm.sock')->status()) {
$this->server->phpfpm_mode = 'socket';
drush_log(dt('PHP-FPM unix socket mode detected -SAVE- YES socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
else {
$this->server->phpfpm_mode = 'port';
drush_log(dt('PHP-FPM port mode detected -SAVE- NO socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
}
function verify_server_cmd() {
......@@ -103,6 +114,16 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
drush_log(dt('Extended Nginx Config Active -VERIFY- NO control file found @path.', array('@path' => $nginx_config_mode_file)));
}
// Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
if (provision_file()->exists('/var/run/php5-fpm.sock')->status()) {
$this->server->phpfpm_mode = 'socket';
drush_log(dt('PHP-FPM unix socket mode detected -VERIFY- YES socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
else {
$this->server->phpfpm_mode = 'port';
drush_log(dt('PHP-FPM port mode detected -VERIFY- NO socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
// Call the parent at the end. it will restart the server when it finishes.
parent::verify_server_cmd();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment