mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 04:44:05 +02:00
correct nginx
This commit is contained in:
24
portainer/rootfs/etc/cont-init.d/30-nginx.sh
Normal file
24
portainer/rootfs/etc/cont-init.d/30-nginx.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/with-contenv bashio
|
||||||
|
|
||||||
|
#################
|
||||||
|
# NGINX SETTING #
|
||||||
|
#################
|
||||||
|
|
||||||
|
declare admin_port
|
||||||
|
declare portainer_protocol=http
|
||||||
|
|
||||||
|
# Generate Ingress configuration
|
||||||
|
if bashio::config.true 'ssl'; then
|
||||||
|
portainer_protocol=https
|
||||||
|
|
||||||
|
bashio::var.json \
|
||||||
|
interface "$(bashio::addon.ip_address)" \
|
||||||
|
port "^$(bashio::addon.ingress_port)" \
|
||||||
|
protocol "${portainer_protocol}" \
|
||||||
|
certfile "$(bashio::config 'certfile')" \
|
||||||
|
keyfile "$(bashio::config 'keyfile')" \
|
||||||
|
ssl "^$(bashio::config 'ssl')" \
|
||||||
|
| tempio \
|
||||||
|
-template /etc/nginx/templates/ingress.gtpl \
|
||||||
|
-out /etc/nginx/servers/ingress.conf
|
||||||
|
fi
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
|
||||||
|
|
||||||
#################
|
|
||||||
# NGINX SETTING #
|
|
||||||
#################
|
|
||||||
declare port
|
|
||||||
declare certfile
|
|
||||||
declare ingress_interface
|
|
||||||
declare ingress_port
|
|
||||||
declare keyfile
|
|
||||||
|
|
||||||
port=$(bashio::addon.port 80)
|
|
||||||
if bashio::var.has_value "${port}"; then
|
|
||||||
bashio::config.require.ssl
|
|
||||||
|
|
||||||
if bashio::config.true 'ssl'; then
|
|
||||||
certfile=$(bashio::config 'certfile')
|
|
||||||
keyfile=$(bashio::config 'keyfile')
|
|
||||||
|
|
||||||
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
|
|
||||||
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
|
|
||||||
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
|
|
||||||
|
|
||||||
else
|
|
||||||
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
ingress_port=$(bashio::addon.ingress_port)
|
|
||||||
ingress_interface=$(bashio::addon.ip_address)
|
|
||||||
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
|
||||||
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
|
||||||
1
portainer/rootfs/etc/nginx/servers/.gitkeep
Normal file
1
portainer/rootfs/etc/nginx/servers/.gitkeep
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Without requirements or design, programming is the art of adding bugs to an empty text file. (Louis Srygley)
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
server {
|
|
||||||
listen %%interface%%:1337 default_server;
|
|
||||||
|
|
||||||
include /etc/nginx/includes/server_params.conf;
|
|
||||||
include /etc/nginx/includes/proxy_params.conf;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://backend/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /portainer/ws/ {
|
|
||||||
proxy_pass http://backend/ws/;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
17
portainer/rootfs/etc/nginx/templates/ingress.gtpl
Normal file
17
portainer/rootfs/etc/nginx/templates/ingress.gtpl
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
server {
|
||||||
|
listen {{ .interface }}:{{ .port }} default_server;
|
||||||
|
server_name vue.torrent;
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /vuetorrent/public/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api {
|
||||||
|
proxy_pass {{ .protocol }}://backend;
|
||||||
|
http2_push_preload on;
|
||||||
|
client_max_body_size 10M;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user