Nginx enhancements - split configuration (nginx_*.inc stubs)
This commit is contained in:
parent
eb5ede75f0
commit
0342dfe641
@ -67,24 +67,15 @@ server {
|
|||||||
You may report this at <a href='mailto:$server_admin'>$server_admin</a>.</span>";
|
You may report this at <a href='mailto:$server_admin'>$server_admin</a>.</span>";
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# Static service.
|
# Optional export backups function.
|
||||||
# location / {
|
# Needs ACLs, see the include file.
|
||||||
# root $PAR_SERVICE/storage/volumes/staticweb/;
|
#include $PAR_SERVICE/configs/nginx_xport.inc;
|
||||||
# allow all;
|
|
||||||
# autoindex off;
|
|
||||||
# index index.html index.htm;
|
|
||||||
# try_files $ri $uri/ =404;
|
|
||||||
# }
|
|
||||||
#
|
#
|
||||||
# No static service, but we may provide the OPTIONS for a potential DAV client.
|
# Optional simple static service.
|
||||||
# location / {
|
#include $PAR_SERVICE/configs/nginx_static.inc;
|
||||||
# types { } default_type text/html;
|
#
|
||||||
## dav_ext_methods OPTIONS;
|
# Optional simple disabled-static servioe.
|
||||||
# if ($request_method != OPTIONS) {
|
#include $PAR_SERVICE/configs/nginx_nostatic.inc;
|
||||||
# return 404 "<span style='font-size: x-large'>Sorry try <a href='$scheme://$server_name/$PAR_LOCATION'>$scheme://$server_name/$PAR_LOCATION</a> instead.</span>";
|
|
||||||
## return 302 $scheme://$server_name/$PAR_LOCATION;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# The SSL part
|
# The SSL part
|
||||||
|
11
.templates/nginx/nginx_nostatic.inc
Normal file
11
.templates/nginx/nginx_nostatic.inc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Includable nginx configuration.
|
||||||
|
#
|
||||||
|
# A simple no-static service.
|
||||||
|
location / {
|
||||||
|
types { } default_type text/html;
|
||||||
|
# dav_ext_methods OPTIONS;
|
||||||
|
if ($request_method != OPTIONS) {
|
||||||
|
return 404 "<span style='font-size: x-large'>Sorry try <a href='$scheme://$server_name/$PAR_LOCATION'>$scheme://$server_name/$PAR_LOCATION</a> instead.</span>";
|
||||||
|
# return 302 $scheme://$server_name/$PAR_LOCATION;
|
||||||
|
}
|
||||||
|
}
|
10
.templates/nginx/nginx_static.inc
Normal file
10
.templates/nginx/nginx_static.inc
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Includable nginx configuration.
|
||||||
|
#
|
||||||
|
# A simple static service.
|
||||||
|
location / {
|
||||||
|
root $PAR_SERVICE/storage/volumes/staticweb/;
|
||||||
|
allow all;
|
||||||
|
autoindex off;
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $ri $uri/ =404;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
PAR_SERVICENAME=
|
PAR_SERVICENAME=""
|
||||||
PAR_PROXYHOST="localhost"
|
PAR_PROXYHOST="localhost"
|
||||||
PAR_PROXYPORT="8201"
|
PAR_PROXYPORT="8201"
|
||||||
PAR_SERVERNAME="myservice.example.com"
|
PAR_SERVERNAME="myservice.example.com"
|
||||||
@ -18,8 +18,13 @@ PAR_SERVICE="$HOME/services/$PAR_SERVICENAME"
|
|||||||
PARAMETERS='$PAR_ACMEHOST:$PAR_ACMEPORT:$PAR_SERVICE:$PAR_PROXYHOST:$PAR_PROXYPORT:$PAR_SERVERNAME:$PAR_LOCATION:$PAR_WEBMASTER'
|
PARAMETERS='$PAR_ACMEHOST:$PAR_ACMEPORT:$PAR_SERVICE:$PAR_PROXYHOST:$PAR_PROXYPORT:$PAR_SERVERNAME:$PAR_LOCATION:$PAR_WEBMASTER'
|
||||||
for parameter in $(echo "$PARAMETERS" | tr ":" "\n")
|
for parameter in $(echo "$PARAMETERS" | tr ":" "\n")
|
||||||
do export ${parameter:1}; done
|
do export ${parameter:1}; done
|
||||||
cat "$PAR_SERVICE/.templates/nginx/nginx.conf" | envsubst "$PARAMETERS" \
|
for template in $(cd "$PAR_SERVICE/.templates/nginx/"; ls -1 nginx*) ""
|
||||||
> "$PAR_SERVICE/configs/nginx.conf"
|
do
|
||||||
|
if [ -n "$template" ]; then
|
||||||
|
cat "$PAR_SERVICE/.templates/nginx/$template" | envsubst "$PARAMETERS" \
|
||||||
|
> "$PAR_SERVICE/configs/$template"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
touch $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log
|
touch $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log
|
||||||
chmod 660 $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log
|
chmod 660 $PAR_SERVICE/logs/web/access.log $PAR_SERVICE/logs/web/error.log
|
||||||
|
Loading…
x
Reference in New Issue
Block a user