mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
nginx_proxy: Include /ssl/nginx_proxy/<domain>*.conf in nginx.conf (#259)
* nginx_proxy: Allow customization with included config files from /share Provides a way to add additional configuration to the default, for example proxy_pass locations before the default root location, as well as additional complete server configs. * nginx_proxy: Run logo.png through zopflipng -m * nginx_proxy: Bump version to 1.0, add CHANGELOG.md * Update CHANGELOG.md
This commit is contained in:
committed by
Pascal Vizeli
parent
9698176025
commit
e5078a7929
6
nginx_proxy/CHANGELOG.md
Normal file
6
nginx_proxy/CHANGELOG.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
## 1.0
|
||||
- Add customization mechanism using included config snippets from /share
|
||||
- Optimize logo.png
|
||||
- Update base image
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "NGINX Home Assistant SSL proxy",
|
||||
"version": "0.7",
|
||||
"version": "1.0",
|
||||
"slug": "nginx_proxy",
|
||||
"description": "An SSL/TLS proxy",
|
||||
"url": "https://home-assistant.io/addons/nginx_proxy/",
|
||||
@@ -10,16 +10,26 @@
|
||||
"80/tcp": 80,
|
||||
"443/tcp": 443
|
||||
},
|
||||
"map": ["ssl"],
|
||||
"map": ["ssl", "share"],
|
||||
"options": {
|
||||
"domain": null,
|
||||
"certfile": "fullchain.pem",
|
||||
"keyfile": "privkey.pem"
|
||||
"keyfile": "privkey.pem",
|
||||
"customize": {
|
||||
"active": false,
|
||||
"default": "nginx_proxy_default*.conf",
|
||||
"servers": "nginx_proxy/*.conf"
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"domain": "str",
|
||||
"certfile": "str",
|
||||
"keyfile": "str"
|
||||
"keyfile": "str",
|
||||
"customize": {
|
||||
"active": "bool",
|
||||
"default": "str",
|
||||
"servers": "str"
|
||||
}
|
||||
},
|
||||
"image": "homeassistant/{arch}-addon-nginx_proxy"
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 58 KiB |
@@ -48,6 +48,8 @@ http {
|
||||
|
||||
proxy_buffering off;
|
||||
|
||||
#include /share/nginx_proxy_default*.conf;
|
||||
|
||||
location / {
|
||||
proxy_pass http://homeassistant:8123;
|
||||
proxy_set_header Host $host;
|
||||
@@ -58,4 +60,6 @@ http {
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
#include /share/nginx_proxy/*.conf;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ SNAKEOIL_KEY=/data/ssl-cert-snakeoil.key
|
||||
DOMAIN=$(jq --raw-output ".domain" $CONFIG_PATH)
|
||||
KEYFILE=$(jq --raw-output ".keyfile" $CONFIG_PATH)
|
||||
CERTFILE=$(jq --raw-output ".certfile" $CONFIG_PATH)
|
||||
CUSTOMIZE_ACTIVE=$(jq --raw-output ".customize.active" $CONFIG_PATH)
|
||||
|
||||
# Generate dhparams
|
||||
if [ ! -f "$DHPARAMS_PATH" ]; then
|
||||
@@ -27,6 +28,14 @@ sed -i "s/%%FULLCHAIN%%/$CERTFILE/g" /etc/nginx.conf
|
||||
sed -i "s/%%PRIVKEY%%/$KEYFILE/g" /etc/nginx.conf
|
||||
sed -i "s/%%DOMAIN%%/$DOMAIN/g" /etc/nginx.conf
|
||||
|
||||
# Allow customize configs from share
|
||||
if [ "$CUSTOMIZE_ACTIVE" == "true" ]; then
|
||||
CUSTOMIZE_DEFAULT=$(jq --raw-output ".customize.default" $CONFIG_PATH)
|
||||
sed -i "s|#include /share/nginx_proxy_default.*|include /share/$CUSTOMIZE_DEFAULT;|" /etc/nginx.conf
|
||||
CUSTOMIZE_SERVERS=$(jq --raw-output ".customize.servers" $CONFIG_PATH)
|
||||
sed -i "s|#include /share/nginx_proxy/.*|include /share/$CUSTOMIZE_SERVERS;|" /etc/nginx.conf
|
||||
fi
|
||||
|
||||
# start server
|
||||
echo "[INFO] Run nginx"
|
||||
exec nginx -c /etc/nginx.conf < /dev/null
|
||||
|
||||
Reference in New Issue
Block a user