nginx: introduce support for dynamic modules

Start building sub package that provide dynamic modules.

Each module needs to be loaded using load_modules.
Refer to nginx documentation on how to use this.

This should result in lower memory usage as only used module are loaded.

Also fix the uci-default scripts to add the required ubus module for
luci module.

-fvisibility=hidden is needed to be dropped to correctly support loading
dynamic modules.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi 2021-10-09 01:18:41 +02:00
parent 0a67d0e129
commit 65a676ed56
No known key found for this signature in database
GPG key ID: AC001D09ADBFEAD7
3 changed files with 147 additions and 140 deletions

View file

@ -15,21 +15,6 @@ config NGINX_DAV
Enable the HTTP and WebDAV methods PUT, DELETE, MKCOL, COPY and MOVE.
default n
config NGINX_DAV_EXT
bool
prompt "Enable WebDAV EXT module"
select NGINX_DAV
help
Enable the WebDAV methods PROPFIND, OPTIONS, LOCK, UNLOCK.
default n
config NGINX_UBUS
bool
prompt "Enable UBUS module"
help
Enable UBUS api support directly from the server.
default y
config NGINX_FLV
bool
prompt "Enable FLV module"
@ -195,16 +180,6 @@ config NGINX_PCRE
prompt "Enable PCRE library usage"
default y
config NGINX_NAXSI
bool
prompt "Enable NAXSI module"
default y
config NGINX_LUA
bool
prompt "Enable Lua module"
default n
config NGINX_HTTP_REAL_IP
bool
prompt "Enable HTTP real ip module"
@ -220,20 +195,6 @@ config NGINX_HTTP_SUB
prompt "Enable HTTP sub module"
default n
config NGINX_HEADERS_MORE
bool
prompt "Enable Headers_more module"
help
Set and clear input and output headers...more than "add"!
default y
config NGINX_HTTP_BROTLI
bool
prompt "Enable Brotli compression module"
help
Add support for brotli compression module.
default n
config NGINX_STREAM_CORE_MODULE
bool
prompt "Enable stream support"
@ -257,19 +218,4 @@ config NGINX_STREAM_SSL_PREREAD_MODULE
Add support for NGINX request streaming using information from the ClientHello message without terminating SSL/TLS.
default n
config NGINX_RTMP_MODULE
bool
prompt "Enable RTMP module"
help
Add support for NGINX-based Media Streaming Server module.
DASH enhanced - https://github.com/ut0mt8/nginx-rtmp-module
default n
config NGINX_TS_MODULE
bool
prompt "Enable TS module"
help
Add support for MPEG-TS Live Module module.
default n
endmenu

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=nginx
PKG_VERSION:=1.21.3
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://nginx.org/download/
@ -27,9 +27,7 @@ PKG_BUILD_FLAGS:=gc-sections
PKG_CONFIG_DEPENDS := \
CONFIG_NGINX_DAV \
CONFIG_NGINX_DAV_EXT \
CONFIG_NGINX_FLV \
CONFIG_NGINX_UBUS \
CONFIG_NGINX_STUB_STATUS \
CONFIG_NGINX_HTTP_CHARSET \
CONFIG_NGINX_HTTP_GZIP \
@ -62,17 +60,11 @@ PKG_CONFIG_DEPENDS := \
CONFIG_NGINX_HTTP_CACHE \
CONFIG_NGINX_HTTP_V2 \
CONFIG_NGINX_PCRE \
CONFIG_NGINX_NAXSI \
CONFIG_NGINX_LUA \
CONFIG_NGINX_HTTP_REAL_IP \
CONFIG_NGINX_HTTP_SECURE_LINK \
CONFIG_NGINX_HTTP_BROTLI \
CONFIG_NGINX_HEADERS_MORE \
CONFIG_NGINX_STREAM_CORE_MODULE \
CONFIG_NGINX_STREAM_SSL_MODULE \
CONFIG_NGINX_STREAM_SSL_PREREAD_MODULE \
CONFIG_NGINX_RTMP_MODULE \
CONFIG_NGINX_TS_MODULE \
CONFIG_OPENSSL_ENGINE \
CONFIG_OPENSSL_WITH_NPN
@ -101,8 +93,7 @@ define Package/nginx-ssl
VARIANT:=ssl
DEPENDS+= +NGINX_PCRE:libpcre \
+NGINX_PCRE:nginx-ssl-util +!NGINX_PCRE:nginx-ssl-util-nopcre \
+NGINX_HTTP_GZIP:zlib +NGINX_LUA:liblua +NGINX_DAV:libxml2 \
+NGINX_UBUS:libubus +NGINX_UBUS:libblobmsg-json +NGINX_UBUS:libjson-c
+NGINX_HTTP_GZIP:zlib +NGINX_DAV:libxml2
EXTRA_DEPENDS:=nginx-ssl-util$(if $(CONFIG_NGINX_PCRE),,-nopcre) (>=1.5-1) (<2)
CONFLICTS:=nginx-all-module
endef
@ -114,8 +105,10 @@ Package/nginx-ssl/description = $(Package/nginx/description) \
define Package/nginx-all-module
$(Package/nginx/default)
TITLE += with ALL module selected
DEPENDS+=+libpcre +nginx-ssl-util +zlib +liblua +libxml2 +libubus \
+libblobmsg-json +libjson-c
DEPENDS+=+libpcre +nginx-ssl-util +zlib +libxml2 \
+nginx-mod-ubus +nginx-mod-naxsi +nginx-mod-lua \
+nginx-mod-dav-ext +nginx-mod-stream +nginx-mod-headers-more \
+nginx-mod-brotli +nginx-mod-rtmp +nginx-mod-ts
EXTRA_DEPENDS:=nginx-ssl-util (>=1.5-1) (<2)
VARIANT:=all-module
PROVIDES += nginx-ssl
@ -137,7 +130,6 @@ endef
Package/nginx-ssl/conffiles = $(Package/nginx/conffiles)
Package/nginx-all-module/conffiles = $(Package/nginx/conffiles)
ADDITIONAL_MODULES:= --with-http_ssl_module
ifneq ($(BUILD_VARIANT),all-module)
@ -233,12 +225,6 @@ ifneq ($(BUILD_VARIANT),all-module)
ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE),y)
ADDITIONAL_MODULES += --without-http_upstream_keepalive_module
endif
ifeq ($(CONFIG_NGINX_NAXSI),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src
endif
ifeq ($(CONFIG_NGINX_LUA),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx
endif
ifeq ($(CONFIG_IPV6),y)
ADDITIONAL_MODULES += --with-ipv6
endif
@ -251,12 +237,6 @@ ifneq ($(BUILD_VARIANT),all-module)
ifeq ($(CONFIG_NGINX_DAV),y)
ADDITIONAL_MODULES += --with-http_dav_module
endif
ifeq ($(CONFIG_NGINX_DAV_EXT),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module
endif
ifeq ($(CONFIG_NGINX_UBUS),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module
endif
ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST),y)
ADDITIONAL_MODULES += --with-http_auth_request_module
endif
@ -272,51 +252,46 @@ ifneq ($(BUILD_VARIANT),all-module)
ifeq ($(CONFIG_NGINX_HTTP_SUB),y)
ADDITIONAL_MODULES += --with-http_sub_module
endif
ifeq ($(CONFIG_NGINX_STREAM_CORE_MODULE),y)
ADDITIONAL_MODULES += --with-stream
endif
ifeq ($(CONFIG_NGINX_STREAM_SSL_MODULE),y)
ADDITIONAL_MODULES += --with-stream_ssl_module
endif
ifeq ($(CONFIG_NGINX_STREAM_SSL_PREREAD_MODULE),y)
ADDITIONAL_MODULES += --with-stream_ssl_preread_module
endif
ifeq ($(CONFIG_NGINX_HEADERS_MORE),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-headers-more
endif
ifeq ($(CONFIG_NGINX_HTTP_BROTLI),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-brotli
endif
ifeq ($(CONFIG_NGINX_RTMP_MODULE),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-rtmp
endif
ifeq ($(CONFIG_NGINX_TS_MODULE),y)
ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ts
endif
else
CONFIG_NGINX_HEADERS_MORE:=y
CONFIG_NGINX_HTTP_BROTLI:=y
CONFIG_NGINX_RTMP_MODULE:=y
CONFIG_NGINX_TS_MODULE:=y
CONFIG_NGINX_NAXSI:=y
CONFIG_NGINX_LUA:=y
CONFIG_NGINX_DAV:=y
CONFIG_NGINX_DAV_EXT:=y
CONFIG_NGINX_UBUS:=y
ADDITIONAL_MODULES += --with-ipv6 --with-http_stub_status_module --with-http_flv_module \
--with-http_dav_module \
--with-http_auth_request_module --with-http_v2_module --with-http_realip_module \
--with-http_secure_link_module --with-http_sub_module \
--with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \
--add-module=$(PKG_BUILD_DIR)/nginx-headers-more \
--add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src \
--add-module=$(PKG_BUILD_DIR)/lua-nginx \
--add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module \
--add-module=$(PKG_BUILD_DIR)/nginx-brotli --add-module=$(PKG_BUILD_DIR)/nginx-rtmp \
--add-module=$(PKG_BUILD_DIR)/nginx-ts --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module
--with-stream_ssl_module --with-stream_ssl_preread_module \
config_files += koi-utf koi-win win-utf fastcgi_params uwsgi_params
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-naxsi),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-lua),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/lua-nginx
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-dav-ext),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module
endif
ifneq ($(CONFIG_NGINX_STREAM_CORE_MODULE),)
ADDITIONAL_MODULES += --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-ubus),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/nginx-ubus-module
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-headers-more),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/nginx-headers-more
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-brotli),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/nginx-brotli
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-rtmp),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/nginx-rtmp
endif
ifneq ($(CONFIG_PACKAGE_nginx-mod-ts),)
ADDITIONAL_MODULES += --add-dynamic-module=$(PKG_BUILD_DIR)/nginx-ts
endif
ifeq ($(CONFIG_NGINX_GEOIP_MODULE),y)
ADDITIONAL_MODULES += --with-http_geoip_module=dynamic
endif
define Package/nginx-mod-luci
TITLE:=Nginx on LuCI
SECTION:=net
@ -324,7 +299,7 @@ define Package/nginx-mod-luci
SUBMENU:=Web Servers/Proxies
TITLE:=Support file for Nginx
URL:=http://nginx.org/
DEPENDS:=+uwsgi +uwsgi-luci-support +nginx
DEPENDS:=+uwsgi +uwsgi-luci-support +nginx +nginx-mod-ubus
# TODO: add PROVIDES when removing nginx-mod-luci-ssl
# PROVIDES:=nginx-mod-luci-ssl
endef
@ -333,10 +308,93 @@ define Package/nginx-mod-luci/description
Support file for LuCI in nginx. Include custom nginx configuration, autostart script for uwsgi.
endef
NGINX_MODULES :=
TARGET_CFLAGS += -fvisibility=hidden -DNGX_LUA_NO_BY_LUA_BLOCK
# $(1) module name
# $(2) module additional dependency
# $(3) module so name (stripped of the finaly _module.so)
# $(4) module description
define module
define Package/nginx-mod-$(strip $(1))
$(call Package/nginx/default)
DEPENDS:=+nginx-ssl $(2)
TITLE:=Nginx $(1) module
endef
ifeq ($(CONFIG_NGINX_LUA),y)
define Package/nginx-mod-$(strip $(1))/description
$(4)
endef
define Package/nginx-mod-$(strip $(1))/install
$(INSTALL_DIR) $$(1)/usr/lib/nginx/modules
$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/nginx/modules/$(3)_module.so $$(1)/usr/lib/nginx/modules
endef
NGINX_MODULES += nginx-mod-$(strip $(1))
endef
define brotli
define Package/nginx-mod-brotli
$(call Package/nginx/default)
DEPENDS:=+nginx-ssl
TITLE:=Nginx Brotli module
endef
define Package/nginx-mod-brotli/description
Add support for brotli compression module.
endef
define Package/nginx-mod-brotli/install
$(INSTALL_DIR) $$(1)/usr/lib/nginx/modules
$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/nginx/modules/ngx_http_brotli_filter_module.so $$(1)/usr/lib/nginx/modules
$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/nginx/modules/ngx_http_brotli_static_module.so $$(1)/usr/lib/nginx/modules
endef
NGINX_MODULES += nginx-mod-brotli
endef
define naxsi
define Package/nginx-mod-naxsi
$(call Package/nginx/default)
DEPENDS:=+nginx-ssl
TITLE:=Nginx naxsi module
endef
define Package/nginx-mod-naxsi/description
Enable NAXSI module.
endef
define Package/nginx-mod-naxsi/install
$(INSTALL_DIR) $$(1)/usr/lib/nginx/modules
$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/nginx/modules/ngx_http_naxsi_module.so $$(1)/usr/lib/nginx/modules
$(INSTALL_DIR) $$(1)/etc/nginx
$(INSTALL_BIN) $$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $$(1)/etc/nginx
chmod 0640 $$(1)/etc/nginx/naxsi_core.rules
$(INSTALL_BIN) $$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $$(1)/etc/nginx
chmod 0640 $$(1)/etc/nginx/naxsi_core.rules
endef
NGINX_MODULES += nginx-mod-naxsi
endef
$(eval $(call module,lua, +liblua,ngx_http_lua, Enable Lua module))
$(eval $(call module,stream, +@NGINX_STREAM_CORE_MODULE,ngx_stream, Add support for NGINX request streaming.))
$(eval $(call module,ubus, +libubus +libjson-c +libblobmsg-json +@NGINX_UBUS,ngx_http_ubus, Enable UBUS api support directly from the server.))
$(eval $(call module,dav-ext, +@NGINX_DAV,ngx_http_dav_ext, Enable the WebDAV methods PROPFIND OPTIONS LOCK UNLOCK.))
$(eval $(call module,headers-more,,ngx_http_headers_more_filter, Set and clear input and output headers...more than "add"!))
$(eval $(call module,rtmp,,ngx_rtmp, Add support for NGINX-based Media Streaming Server module. \
DASH enhanced - https://github.com/ut0mt8/nginx-rtmp-module))
$(eval $(call module, ts,,ngx_http_ts, Add support for MPEG-TS Live Module module.))
$(eval $(call brotli))
$(eval $(call naxsi))
PKG_CONFIG_DEPENDS += $(patsubst %,CONFIG_PACKAGE_%,$(NGINX_MODULES))
TARGET_CFLAGS += -DNGX_LUA_NO_BY_LUA_BLOCK
ifneq ($(CONFIG_PACKAGE_nginx-mod-lua),)
CONFIGURE_VARS += LUA_INC=$(STAGING_DIR)/usr/include \
LUA_LIB=$(STAGING_DIR)/usr/lib
endif
@ -347,6 +405,7 @@ CONFIGURE_ARGS += \
--crossbuild=Linux::$(ARCH) \
--prefix=/usr \
--conf-path=/etc/nginx/nginx.conf \
--modules-path=/usr/lib/nginx/modules \
$(ADDITIONAL_MODULES) \
--error-log-path=stderr \
--pid-path=/var/run/nginx.pid \
@ -358,7 +417,8 @@ CONFIGURE_ARGS += \
--with-cc="$(TARGET_CC)" \
--with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
--with-ld-opt="$(TARGET_LDFLAGS)" \
--without-http_upstream_zone_module
--without-http_upstream_zone_module \
--without-pcre2
define Package/nginx-mod-luci/install
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
@ -374,13 +434,6 @@ define Package/nginx-ssl/install
$(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
ifeq ($(CONFIG_NGINX_NAXSI),y)
$(INSTALL_DIR) $(1)/etc/nginx
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx
chmod 0640 $(1)/etc/nginx/naxsi_core.rules
endif
$(if $(CONFIG_NGINX_NAXSI),$($(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx))
$(if $(CONFIG_NGINX_NAXSI),$(chmod 0640 $(1)/etc/nginx/naxsi_core.rules))
endef
Package/nginx-all-module/install = $(Package/nginx-ssl/install)
@ -513,13 +566,13 @@ endef
define Build/Patch
$(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nginx,nginx/)
ifneq "$(or $(CONFIG_NGINX_DAV_EXT),$(QUILT))" ""
ifneq "$(or $(CONFIG_PACKAGE_nginx-mod-dav-ext),$(QUILT))" ""
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/dav-nginx,dav-nginx/)
endif
ifneq "$(or $(CONFIG_NGINX_LUA),$(QUILT))" ""
ifneq "$(or $(CONFIG_PACKAGE_nginx-mod-lua),$(QUILT))" ""
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/lua-nginx,lua-nginx/)
endif
ifneq "$(or $(CONFIG_NGINX_RTMP_MODULE),$(QUILT))" ""
ifneq "$(or $(CONFIG_PACKAGE_nginx-mod-rtmp),$(QUILT))" ""
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtmp-nginx,rtmp-nginx/)
endif
$(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
@ -537,42 +590,42 @@ define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(PKG_UNPACK)
ifeq ($(CONFIG_NGINX_NAXSI),y)
ifneq ($(CONFIG_PACKAGE_nginx-mod-naxsi),)
$(eval $(call Download,nginx-naxsi))
$(Prepare/nginx-naxsi)
endif
ifneq "$(or $(CONFIG_NGINX_LUA),$(QUILT))" ""
ifneq "$(or $(CONFIG_PACKAGE_nginx-mod-lua),$(QUILT))" ""
$(eval $(call Download,lua-nginx))
$(Prepare/lua-nginx)
endif
ifeq ($(CONFIG_NGINX_HTTP_BROTLI),y)
ifneq ($(CONFIG_PACKAGE_nginx-mod-brotli),)
$(eval $(call Download,nginx-brotli))
$(Prepare/nginx-brotli)
endif
ifeq ($(CONFIG_NGINX_HEADERS_MORE),y)
ifneq ($(CONFIG_PACKAGE_nginx-mod-headers-more),)
$(eval $(call Download,nginx-headers-more))
$(Prepare/nginx-headers-more)
endif
ifneq "$(or $(CONFIG_NGINX_RTMP_MODULE),$(QUILT))" ""
ifneq "$(or $(CONFIG_PACKAGE_nginx-mod-rtmp),$(QUILT))" ""
$(eval $(call Download,nginx-rtmp))
$(Prepare/nginx-rtmp)
endif
ifeq ($(CONFIG_NGINX_TS_MODULE),y)
ifneq ($(CONFIG_PACKAGE_nginx-mod-ts),)
$(eval $(call Download,nginx-ts))
$(Prepare/nginx-ts)
endif
ifneq "$(or $(CONFIG_NGINX_DAV_EXT),$(QUILT))" ""
ifneq "$(or $(CONFIG_PACKAGE_nginx-mod-dav-ext),$(QUILT))" ""
$(eval $(call Download,nginx-dav-ext-module))
$(Prepare/nginx-dav-ext-module)
endif
ifeq ($(CONFIG_NGINX_UBUS),y)
ifneq ($(CONFIG_PACKAGE_nginx-mod-ubus),)
$(eval $(call Download,nginx-ubus-module))
$(Prepare/nginx-ubus-module)
endif
@ -584,6 +637,8 @@ $(eval $(call BuildPackage,nginx-ssl))
$(eval $(call BuildPackage,nginx-all-module))
$(eval $(call BuildPackage,nginx-mod-luci))
$(foreach m,$(NGINX_MODULES),$(eval $(call BuildPackage,$(m))))
# TODO: remove after a transition period (together with pkg nginx-util):
# It is for smoothly substituting nginx and nginx-mod-luci-ssl (by nginx-ssl
# respectively nginx-mod-luci). Add above commented PROVIDES when removing.

View file

@ -1,6 +1,6 @@
#!/bin/sh
if nginx -V 2>&1 | grep -q ubus; then
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
@ -9,6 +9,12 @@ location /ubus {
ubus_socket_path /var/run/ubus/ubus.sock;
ubus_parallel_req 2;
}
EOT
fi
if [ ! -f "/etc/nginx/module.d/luci.module" ]; then
cat <<EOT >> /etc/nginx/module.d/luci.module
load_module /usr/lib/nginx/modules/ngx_http_ubus_module.so;
EOT
fi
fi