Nginxproxymanager: restore NPM nginx.conf after OpenResty rebuid (#14421)

When OpenResty is rebuilt via 'make install', it overwrites
/usr/local/openresty/nginx/conf/nginx.conf with the stock OpenResty
default config, dropping all NPM-specific include directives. This
causes port 81 to stop listening and conf.d configs to be ignored.

After the build, restore the NPM nginx.conf from the deployed source,
re-apply daemon/include-path patches, then apply user/pid fixes.
This commit is contained in:
CanbiZ (MickLesk)
2026-05-11 22:04:04 +02:00
committed by GitHub
parent b15e84e2ba
commit 07abb105d0

View File

@@ -92,6 +92,11 @@ ExecStart=/usr/local/openresty/nginx/sbin/nginx -g 'daemon off;'
[Install]
WantedBy=multi-user.target
EOF
if [ -f /opt/nginxproxymanager/docker/rootfs/etc/nginx/nginx.conf ]; then
cp /opt/nginxproxymanager/docker/rootfs/etc/nginx/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
sed -i 's+^daemon+#daemon+g' /usr/local/openresty/nginx/conf/nginx.conf
sed -i 's+include conf.d+include /etc/nginx/conf.d+g' /usr/local/openresty/nginx/conf/nginx.conf
fi
sed -i 's/user npm/user root/g; s/^pid/#pid/g' /usr/local/openresty/nginx/conf/nginx.conf
systemctl daemon-reload
systemctl unmask openresty 2>/dev/null || true