coreos-home-server/service/nginx/systemd/nginx-proxy-http@.service

20 lines
814 B
Desktop File

[Unit]
Description=NGINX HTTP/S Proxy for %I
Wants=nginx.service %i.service
After=nginx.service %i.service
[Service]
Type=oneshot
RemainAfterExit=true
SyslogIdentifier=%N
Environment=SERVER_NAME=%i SSL_CERT_NAME=%i UPSTREAM_HOST=%i UPSTREAM_PORT=8080 UPSTREAM_PATH=
Environment=NGINX_CONF=%E/coreos-home-server/nginx/service/%p.conf.template
ExecStart=/bin/sh -c "envsubst '$SERVER_NAME $SERVER_NAME_ALT $SSL_CERT_NAME $UPSTREAM_HOST $UPSTREAM_PORT $UPSTREAM_PATH' < ${NGINX_CONF} > /tmp/%N.conf"
ExecStartPost=/bin/sh -c 'podman cp /tmp/%N.conf nginx:/etc/nginx/conf.d/%i.conf && rm -f /tmp/%N.conf'
ExecStartPost=/bin/podman exec nginx nginx -s reload
ExecStop=/bin/podman exec nginx rm --force /etc/nginx/conf.d/%i.conf
ExecStopPost=/bin/podman exec nginx nginx -s reload
[Install]
WantedBy=multi-user.target