Commit 6350fbfd authored by omega8cc's avatar omega8cc

Nginx: Use safe fallback for mysteriously empty $db_port

parent 92b23663
......@@ -41,7 +41,15 @@ server {
fastcgi_param db_user <?php print urlencode($db_user); ?>;
fastcgi_param db_passwd <?php print urlencode($db_passwd); ?>;
fastcgi_param db_host <?php print urlencode($db_host); ?>;
fastcgi_param db_port <?php print urlencode($this->server->db_port); ?>;
<?php
// Until the real source of this problem is fixed elsewhere, we have to
// use this simple fallback to guarantee that empty db_port does not
// break Nginx reload which results with downtime for the affected vhosts.
if (!$db_port) {
$db_port = $this->server->db_port ? $this->server->db_port : '3306';
}
?>
fastcgi_param db_port <?php print urlencode($db_port); ?>;
listen <?php print "{$ip_address}:{$http_ssl_port}"; ?>;
server_name <?php
// this is the main vhost, so we need to put the redirection
......
......@@ -20,6 +20,14 @@ if (!$satellite_mode && $server->satellite_mode) {
$satellite_mode = $server->satellite_mode;
}
?>
<?php
// Until the real source of this problem is fixed elsewhere, we have to
// use this simple fallback to guarantee that empty db_port does not
// break Nginx reload which results with downtime for the affected vhosts.
if (!$db_port) {
$db_port = $this->server->db_port ? $this->server->db_port : '3306';
}
?>
#######################################################
<?php if ($nginx_config_mode == 'extended'): ?>
### nginx.conf site level extended vhost include start
......@@ -212,7 +220,7 @@ location ^~ /<?php print $subdir; ?> {
fastcgi_param db_user <?php print urlencode($db_user); ?>;
fastcgi_param db_passwd <?php print urlencode($db_passwd); ?>;
fastcgi_param db_host <?php print urlencode($db_host); ?>;
fastcgi_param db_port <?php print urlencode($this->server->db_port); ?>;
fastcgi_param db_port <?php print urlencode($db_port); ?>;
fastcgi_param HTTP_HOST <?php print $subdir; ?>.$host;
fastcgi_param RAW_HOST $host;
......@@ -605,7 +613,7 @@ location ^~ /<?php print $subdir; ?> {
fastcgi_param db_user <?php print urlencode($db_user); ?>;
fastcgi_param db_passwd <?php print urlencode($db_passwd); ?>;
fastcgi_param db_host <?php print urlencode($db_host); ?>;
fastcgi_param db_port <?php print urlencode($this->server->db_port); ?>;
fastcgi_param db_port <?php print urlencode($db_port); ?>;
fastcgi_param HTTP_HOST <?php print $subdir; ?>.$host;
fastcgi_param RAW_HOST $host;
......@@ -791,7 +799,7 @@ location ^~ /<?php print $subdir; ?> {
fastcgi_param db_user <?php print urlencode($db_user); ?>;
fastcgi_param db_passwd <?php print urlencode($db_passwd); ?>;
fastcgi_param db_host <?php print urlencode($db_host); ?>;
fastcgi_param db_port <?php print urlencode($this->server->db_port); ?>;
fastcgi_param db_port <?php print urlencode($db_port); ?>;
fastcgi_param HTTP_HOST <?php print $subdir; ?>.$host;
fastcgi_param RAW_HOST $host;
......@@ -867,7 +875,7 @@ location ^~ /<?php print $subdir; ?> {
fastcgi_param db_user <?php print urlencode($db_user); ?>;
fastcgi_param db_passwd <?php print urlencode($db_passwd); ?>;
fastcgi_param db_host <?php print urlencode($db_host); ?>;
fastcgi_param db_port <?php print urlencode($this->server->db_port); ?>;
fastcgi_param db_port <?php print urlencode($db_port); ?>;
fastcgi_param HTTP_HOST <?php print $subdir; ?>.$host;
fastcgi_param RAW_HOST $host;
......@@ -1011,7 +1019,7 @@ location @allowupdate_<?php print $subdir; ?> {
fastcgi_param db_user <?php print urlencode($db_user); ?>;
fastcgi_param db_passwd <?php print urlencode($db_passwd); ?>;
fastcgi_param db_host <?php print urlencode($db_host); ?>;
fastcgi_param db_port <?php print urlencode($this->server->db_port); ?>;
fastcgi_param db_port <?php print urlencode($db_port); ?>;
fastcgi_param HTTP_HOST <?php print $subdir; ?>.$host;
fastcgi_param RAW_HOST $host;
......
......@@ -32,7 +32,15 @@ server {
fastcgi_param db_user <?php print urlencode($db_user); ?>;
fastcgi_param db_passwd <?php print urlencode($db_passwd); ?>;
fastcgi_param db_host <?php print urlencode($db_host); ?>;
fastcgi_param db_port <?php print urlencode($this->server->db_port); ?>;
<?php
// Until the real source of this problem is fixed elsewhere, we have to
// use this simple fallback to guarantee that empty db_port does not
// break Nginx reload which results with downtime for the affected vhosts.
if (!$db_port) {
$db_port = $this->server->db_port ? $this->server->db_port : '3306';
}
?>
fastcgi_param db_port <?php print urlencode($db_port); ?>;
listen *:<?php print $http_port; ?>;
server_name <?php
// this is the main vhost, so we need to put the redirection
......
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