Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
a812506b
Commit
a812506b
authored
May 10, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add update_nginx.sh script
parent
a2f31d58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
115 additions
and
0 deletions
+115
-0
update_nginx.sh
vz/azbyka/update_nginx.sh
+102
-0
update_nginx_all.sh
vz/azbyka/update_nginx_all.sh
+13
-0
No files found.
vz/azbyka/update_nginx.sh
0 → 100755
View file @
a812506b
#!/bin/sh
.
./functions
# TODO: static-fallback
# TODO: for WP only
print_nginx_conf
()
{
cat
<<
EOF
# generated by
$(
realpath
$0
)
error_page
$ECODE
= @cache-
$NAME
;
location @fallback-
$NAME
{
root
$DROOT
;
proxy_pass
$UPSTREAM
;
include include/trans-proxy.conf;
# rewrite to cache if allowed
include include/check-skip-cache.inc;
if (\
$skip_cache
= 0) {
return
$ECODE
;
}
access_log /var/log/nginx/
$ACONF
-fallback-access.log logdetail;
error_log /var/log/nginx/
$ACONF
-fallback-error.log;
}
location @cache-
$NAME
{
root
$DROOT
;
proxy_pass
$UPSTREAM
;
include include/store-hour-proxy.conf;
access_log /var/log/nginx/
$ACONF
-cache-access.log logdetail;
error_log /var/log/nginx/
$ACONF
-cache-error.log;
}
location = /
$NAME
/server-status/ {
proxy_pass
$UPSTREAM
;
include include/trans-proxy.conf;
access_log /var/log/nginx/
$ACONF
-access.log logdetail;
}
location = /
$NAME
{
return 301 /
$NAME
/
$is_args$args
;
}
location /
$NAME
/ {
root
$DROOT
;
# Вместо несуществующих jpg, png, gif отдаём приготовленную картинку
include include/static-stub.conf;
# пробуем отдать напрямую статикой, не получится - на @fallback
include include/static-fallback-
$NAME
.conf;
# TODO: nginx: [emerg] named location "@injection-error_406" can be on the server level only in /etc/nginx/include/stop-injection.conf:65
#include include/stop-injection.conf;
proxy_pass
$UPSTREAM
;
include include/trans-proxy.conf;
# rewrite to cache if allowed
include include/check-skip-cache.inc;
if (\
$skip_cache
= 0) {
return
$ECODE
;
}
access_log /var/log/nginx/
$ACONF
-access.log logdetail;
error_log /var/log/nginx/
$ACONF
-error.log;
}
EOF
}
print_upstream_conf
()
{
[
-n
"
$PHPHOST
"
]
||
PHPHOST
=
"
$VEIP
"
cat
<<
EOF
upstream
$UPSTREAMNAME
{
# server
$VEIP
;
server
$PHPHOST
;
}
EOF
}
TASK
=
"
$1
"
echo
"
$TASK
"
|
grep
-q
"ves/"
||
TASK
=
"ves/
$1
.task"
load_config
"
$TASK
"
DROOT
=
$HOSTHOME
/
$AUSER
/www/
$BASESITE
UPSTREAMNAME
=
"upstream-
$ACONF
"
UPSTREAM
=
"http://
$UPSTREAMNAME
"
VEPORT
=
$(
printf
"%03d"
$((
$VEID
-
100
)))
ECODE
=
$((
430
+
$VEID
-
100
))
echo
"VEPORT:
$VEPORT
ECODE:
$ECODE
"
print_nginx_conf
>
$NGINXSUBDIR
/
$NAME
.conf
if
!
grep
-q
$UPSTREAMNAME
/etc/nginx/httpconf-enabled.d/upstream_
$ACONF
.conf
;
then
print_upstream_conf
>
/etc/nginx/httpconf-enabled.d/upstream_
$ACONF
.conf
fi
vz/azbyka/update_nginx_all.sh
0 → 100755
View file @
a812506b
#!/bin/sh
.
./functions
.
./base.task
||
exit
for
i
in
$NGINXSUBDIR
/
*
.conf
;
do
grep
"update_nginx.sh"
$i
||
continue
N
=
$(
basename
$i
.conf
)
echo
"Updating
$N
..."
./update_nginx.sh
$N
done
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