Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Projects
Groups
Snippets
Sign up now
Login
Sign in
Toggle navigation
Menu
Open sidebar
project
provision
Commits
bded8935
Commit
bded8935
authored
Jan 21, 2015
by
Grazyna Jaworska
Browse files
Nginx: Use safe fallback for mysteriously empty $db_port
parent
27aa1cdf
Changes
3
Hide whitespace changes
Inline
Side-by-side
http/Provision/Config/Nginx/Ssl/vhost_ssl.tpl.php
View file @
bded8935
...
...
@@ -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
...
...
http/Provision/Config/Nginx/subdir.tpl.php
View file @
bded8935
...
...
@@ -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;
...
...
http/Provision/Config/Nginx/vhost.tpl.php
View file @
bded8935
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment