Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai
noblogs-wp
Commits
7f9d64e7
Commit
7f9d64e7
authored
Nov 08, 2015
by
ale
Committed by
lucha
Dec 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read master IP from /etc/noblogs/master
parent
cf842bbf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
wp-nginx-map.php
wp-nginx-map.php
+4
-3
No files found.
wp-nginx-map.php
View file @
7f9d64e7
...
...
@@ -4,7 +4,8 @@
//
// Stampa una mappa delle assegnazioni blog -> backend, per NGINX.
// IP interno del master.
define
(
'NOBLOGS_MASTER'
,
'172.16.1.10'
);
$master_url
=
file_get_contents
(
'/etc/noblogs/master'
);
$noblogs_master
=
parse_url
(
$master_url
)[
'host'
];
// Load wordpress api.
define
(
'WP_CACHE'
,
false
);
...
...
@@ -25,7 +26,7 @@ function printline($s) {
function
backend_to_http_endpoint
(
$backend
)
{
if
(
substr
(
$backend
,
0
,
8
)
!=
'backend_'
)
{
error_log
(
'diamine, di questo backend non so che farmene: '
.
$backend
);
return
NOBLOGS_MASTER
.
':82'
;
return
$noblogs_master
.
':82'
;
}
$id
=
substr
(
$backend
,
8
);
return
'172.16.1.'
.
$id
.
':82'
;
...
...
@@ -39,7 +40,7 @@ function generate_map() {
$blogs
=
get_blogs
();
printline
(
'map $http_host $backend_noblogs {'
);
printline
(
' default http://'
.
NOBLOGS_MASTER
.
':82;'
);
printline
(
' default http://'
.
$noblogs_master
.
':82;'
);
foreach
(
$blogs
as
$blog
)
{
$blog_id
=
$blog
->
blog_id
;
if
(
$blog_id
==
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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