0
0
mirror of https://github.com/openwrt/packages.git synced 2025-02-07 06:59:51 +00:00
packages/net/nginx/files-luci-support/60_nginx-luci-support
Christian Marangi 4c4e49064a nginx: drop deprecated luci.module in module.d
Since we moved to automatic loading of dynamic modules, we need to drop
the previous include luci.module or we end up with nginx failing to
start for old configurations.

Fixes: caffa410ed70 ("nginx: autoload dynamic modules")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-05-09 19:29:49 +02:00

45 lines
1.1 KiB
Bash

#!/bin/sh
if nginx -V 2>&1 | grep -q ubus && [ -f /usr/lib/nginx/modules/ngx_http_ubus_module.so ]; then
if [ -z "$(cat /etc/nginx/conf.d/luci.locations | grep ubus)" ]; then
cat <<EOT >> /etc/nginx/conf.d/luci.locations
location /ubus {
ubus_interpreter;
ubus_socket_path /var/run/ubus/ubus.sock;
ubus_parallel_req 2;
}
EOT
fi
# Drop old reference of luci.module as we migrated to a more automatic approach
[ -f "/etc/nginx/module.d/luci.module" ] && rm /etc/nginx/module.d/luci.module
fi
grep -q /var/run/ubus.sock /etc/nginx/conf.d/luci.locations &&
sed -i 's#/var/run/ubus.sock#/var/run/ubus/ubus.sock#' /etc/nginx/conf.d/luci.locations
if [ -x /etc/init.d/uhttpd ]; then
/etc/init.d/uhttpd disable
if [ -n "$(pgrep uhttpd)" ]; then
/etc/init.d/uhttpd stop
fi
fi
/etc/init.d/nginx enable
if [ -n "$(pgrep nginx)" ]; then
/etc/init.d/nginx restart
else
/etc/init.d/nginx start
fi
/etc/init.d/uwsgi enable
if [ -n "$(pgrep uwsgi)" ]; then
/etc/init.d/uwsgi restart
else
/etc/init.d/uwsgi start
fi
exit 0