packages icon indicating copy to clipboard operation
packages copied to clipboard

nginx: Feature request - add module fancyindeex

Open alex9434 opened this issue 1 year ago • 7 comments

Maintainer: @Ansuel @neheb @hnyman @jefferyto @dangowrt @thess @commodo @BKPepe @feckert @sbyx Environment: OpenWrt 23.05 and snapshot

Tried to include ngx-fancyindex to the nginx build https://github.com/aperezdc/ngx-fancyindex

Here are the modifications I made to the existing Nginx Makefile (... to indicate unchanged parts)

...
PKG_MOD_EXTRA := \
	...
	fancyindex \
	...

PKG_CONFIG_DEPENDS := \
	...
	CONFIG_NGINX_HTTP_ADDITION \
	...

define Download/nginx-mod-fancyindex
  VERSION:=6cdffdb0af493b7c21eedba2f09d8486579f3922
  URL:=https://github.com/aperezdc/ngx-fancyindex.git
  MIRROR_HASH:=skip
  PROTO:=git
endef

...
	$(if $(call IsEnabled,NGINX_HTTP_ADDITION),--with-http_addition_module) \
...
$(eval $(call BuildModule,fancyindex,+@NGINX_HTTP_ADDITION,nginx-fancyindex, \
	Nginx Fancy Index module.))
...

I also added the entry for http_addition to Config_ssl.in.

Unfortunately the build does not work. I get an error that the ipk for Fancyindex cannot be found. For some reason the makefile does not build fancyindex. What am I doing wrong?

Any help greatly appreciated!

alex9434 avatar Mar 23 '24 04:03 alex9434

You should ask in forums. Guide https://openwrt.org/docs/guide-developer/packages describes a step or five you left out.

brada4 avatar Mar 23 '24 10:03 brada4

Hi @brada4 thank you for getting back to me!

I am actually not sure that I did not left out anything because the same steps worked for other nginx modules that I have added to the Makefile myself (e.g. https://github.com/atomx/nginx-http-auth-digest). These additons work without problems using a similar approach to what I have outlined in my original post

There seems to be a reason why fancyindex does not work the same way as other nginx modules and I was hoping that the experts can spot the issue. I have titled this as feature request because I would like to suggest to add fancyindex to the list of nginx modules for the Makefile.

To be clear I am not trying to create a separate package (as described in the guide) but just add fancyindex to the list of loadable modules for the existing nginx Makefile. I apologize if that was not clear enough.

alex9434 avatar Mar 23 '24 14:03 alex9434

can you post the entire Makefile? maybe that helps to see things easier;

commodo avatar Mar 24 '24 15:03 commodo

Hi @commodo and @brada4 . Happy to post it. As I said, digest is working fine but fancyindex is not. I also upgraded some of the other modules to the most recent version and applied an additional patch from cloudflare to speed-up http2 upload to cloudflare CDN and added MP4 pseudo streaming.

Makefile

#
# Copyright (C) 2012-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=nginx
PKG_VERSION:=1.21.3
PKG_RELEASE:=2

PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://nginx.org/download/
PKG_HASH:=14774aae0d151da350417efc4afda5cce5035056e71894836797e1f6e2d1175a

PKG_MAINTAINER:=Thomas Heil <[email protected]> \
				Christian Marangi <[email protected]>
PKG_LICENSE:=2-clause BSD-like license
PKG_CPE_ID:=cpe:/a:nginx:nginx

PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_BUILD_FLAGS:=gc-sections

# 3rd-party modules
PKG_MOD_EXTRA := \
	geoip2 \
	lua \
	lua-resty-core \
	lua-resty-lrucache \
	rtmp \
	dav-ext \
	fancyindex \
	naxsi \
	brotli \
	digest \
	headers-more \
	ts \
	ubus
# official and 3rd-party modules
PKG_MOD_ALL := \
	$(PKG_MOD_EXTRA) \
	stream
PKG_MOD_PATCHED := $(shell find patches -mindepth 1 -maxdepth 1 -type d -name 'nginx-mod-*' | sed -E 's,^patches/nginx-mod-,,')

PKG_CONFIG_DEPENDS := \
	CONFIG_NGINX_DAV \
	CONFIG_NGINX_FLV \
	CONFIG_NGINX_MP4 \
	CONFIG_NGINX_STUB_STATUS \
	CONFIG_NGINX_HTTP_CHARSET \
	CONFIG_NGINX_HTTP_GZIP \
	CONFIG_NGINX_HTTP_GZIP_STATIC \
	CONFIG_NGINX_HTTP_SSI \
	CONFIG_NGINX_HTTP_USERID \
	CONFIG_NGINX_HTTP_ACCESS \
	CONFIG_NGINX_HTTP_AUTH_BASIC \
	CONFIG_NGINX_HTTP_AUTH_REQUEST \
	CONFIG_NGINX_HTTP_AUTOINDEX \
	CONFIG_NGINX_HTTP_GEO \
	CONFIG_NGINX_HTTP_MAP \
	CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
	CONFIG_NGINX_HTTP_REFERER \
	CONFIG_NGINX_HTTP_REWRITE \
	CONFIG_NGINX_HTTP_PROXY \
	CONFIG_NGINX_HTTP_FASTCGI \
	CONFIG_NGINX_HTTP_UWSGI \
	CONFIG_NGINX_HTTP_SCGI \
	CONFIG_NGINX_HTTP_MEMCACHED \
	CONFIG_NGINX_HTTP_LIMIT_CONN \
	CONFIG_NGINX_HTTP_LIMIT_REQ \
	CONFIG_NGINX_HTTP_EMPTY_GIF \
	CONFIG_NGINX_HTTP_BROWSER \
	CONFIG_NGINX_HTTP_UPSTREAM_HASH \
	CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
	CONFIG_NGINX_HTTP_UPSTREAM_LEAST_CONN \
	CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE \
	CONFIG_NGINX_HTTP_UPSTREAM_ZONE \
	CONFIG_NGINX_HTTP_CACHE \
	CONFIG_NGINX_HTTP_ADDITION \
	CONFIG_NGINX_HTTP_V2 \
	CONFIG_NGINX_HTTP_V2_AUTOTUNE \
	CONFIG_NGINX_HTTP_QUIC \
	CONFIG_NGINX_PCRE \
	CONFIG_NGINX_HTTP_REAL_IP \
	CONFIG_NGINX_HTTP_SECURE_LINK \
	CONFIG_NGINX_STREAM_REAL_IP \
	CONFIG_OPENSSL_ENGINE \
	CONFIG_OPENSSL_WITH_NPN \
	$(foreach m,$(PKG_MOD_EXTRA),CONFIG_PACKAGE_$(m))

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk

define Package/nginx/default
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=Web Servers/Proxies
  TITLE:=Nginx web server
  URL:=http://nginx.org/
  DEPENDS:=+libopenssl +libpthread
  # TODO: add PROVIDES when removing nginx
  # PROVIDES:=nginx
endef

define Package/nginx/description
 nginx is an HTTP and reverse proxy server, as well as a mail proxy server, \
 written by Igor Sysoev.
endef

define Package/nginx/conffiles
/etc/nginx/
endef

define Package/nginx-ssl
  $(Package/nginx/default)
  TITLE += with SSL support
  VARIANT:=ssl
  DEPENDS+= +NGINX_PCRE:libpcre2 \
	+NGINX_PCRE:nginx-ssl-util +!NGINX_PCRE:nginx-ssl-util-nopcre \
	+NGINX_HTTP_GZIP:zlib +NGINX_DAV:libxml2
  EXTRA_DEPENDS:=nginx-ssl-util$(if $(CONFIG_NGINX_PCRE),,-nopcre) (>=1.5-1) (<2)
  CONFLICTS:=nginx-full
endef

Package/nginx-ssl/description = $(Package/nginx/description) \
  This variant is compiled with SSL support enabled. To enable additional module \
  select them in the nginx default configuration menu.

define Package/nginx-ssl/config
  source "$(SOURCE)/Config_ssl.in"
endef

Package/nginx-ssl/conffiles = $(Package/nginx/conffiles)

IsEnabled = $(or $(filter full,$(BUILD_VARIANT)),$(CONFIG_$(1)))
IsDisabled = $(if $(call IsEnabled,$(1)),,1)

config_files := mime.types \
	$(if $(call IsEnabled,NGINX_HTTP_CHARSET),koi-utf koi-win win-utf) \
	$(if $(call IsEnabled,NGINX_HTTP_FASTCGI),fastcgi_params) \
	$(if $(call IsEnabled,NGINX_HTTP_UWSGI),uwsgi_params) \
	$(if $(call IsEnabled,NGINX_HTTP_SCGI),scgi_params)

define Package/nginx-ssl/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
	$(INSTALL_DIR) $(1)/etc/nginx/module.d
	$(INSTALL_DIR) $(1)/etc/nginx/conf.d
	$(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
endef

define Package/nginx-ssl/prerm
#!/bin/sh
[ -z "$${IPKG_INSTROOT}" ] || exit 0
[ "$${PKG_UPGRADE}" = "1" ] && exit 0
eval $$(/usr/bin/nginx-util get_env)
[ "$$(uci get "nginx.$${LAN_NAME}.$${MANAGE_SSL}")" = "self-signed" ] || exit 0
rm -f "$$(uci get "nginx.$${LAN_NAME}.ssl_certificate")"
rm -f "$$(uci get "nginx.$${LAN_NAME}.ssl_certificate_key")"
exit 0
endef

define Package/nginx-full
  $(Package/nginx/default)
  TITLE += with ALL config selected
  DEPENDS+=+libpcre2 +nginx-ssl-util +zlib +libxml2
  EXTRA_DEPENDS:=nginx-ssl-util (>=1.5-1) (<2)
  VARIANT:=full
  PROVIDES += nginx-ssl
endef

Package/nginx-full/description = $(Package/nginx/description) \
  This variant is compiled with ALL config selected.

Package/nginx-full/install = $(Package/nginx-ssl/install)

Package/nginx-full/prerm = $(Package/nginx-ssl/prerm)

Package/nginx-full/conffiles = $(Package/nginx/conffiles)

define Package/nginx-mod-luci
  TITLE:=Nginx on LuCI
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=Web Servers/Proxies
  TITLE:=Support file for Nginx
  URL:=http://nginx.org/
  DEPENDS:=+uwsgi +uwsgi-luci-support +nginx-ssl +nginx-mod-ubus
  # TODO: add PROVIDES when removing nginx-mod-luci-ssl
  # PROVIDES:=nginx-mod-luci-ssl
endef

define Package/nginx-mod-luci/description
 Support file for LuCI in nginx. Include custom nginx configuration, autostart script for uwsgi.
endef

define Package/nginx-mod-luci/install
	$(INSTALL_DIR) $(1)/etc/nginx/conf.d
	$(INSTALL_CONF) ./files-luci-support/luci.locations $(1)/etc/nginx/conf.d/
	$(INSTALL_DIR) $(1)/etc/uci-defaults
	$(INSTALL_BIN) ./files-luci-support/60_nginx-luci-support $(1)/etc/uci-defaults/60_nginx-luci-support
endef

define Download/nginx-mod-geoip2
  VERSION:=1cabd8a1f68ea3998f94e9f3504431970f848fbf
  URL:=https://github.com/leev/ngx_http_geoip2_module.git
  MIRROR_HASH:=b4bd8517f6595f28e9cea5370045df476e0f7fa9ca3611d71ba85c518f1a7eda
  PROTO:=git
endef

define Download/nginx-mod-digest
  VERSION:=ac91c88017a6a4f9858a1b883ae8ccba8c6931d0
  URL:=https://github.com/atomx/nginx-http-auth-digest.git
  MIRROR_HASH:=skip
  PROTO:=git
endef

define Package/nginx-mod-lua-resty-lrucache
  $(call Package/nginx/default)
  DEPENDS:=@HAS_LUAJIT_ARCH +luajit2
  TITLE:=Nginx Lua OpenResty lrucache module
endef

define Package/nginx-mod-lua-resty-core
  $(call Package/nginx/default)
  DEPENDS:=+nginx-mod-lua-resty-lrucache
  TITLE:=Nginx Lua OpenResty core module
endef

define Package/nginx-mod-lua-resty-lrucache/install
	$(INSTALL_DIR) $(1)/usr/lib/lua/resty/lrucache
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-lrucache/lib/resty/*.lua $(1)/usr/lib/lua/resty
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-lrucache/lib/resty/lrucache/*.lua $(1)/usr/lib/lua/resty/lrucache
endef

define Package/nginx-mod-lua-resty-core/install
	$(INSTALL_DIR) $(1)/usr/lib/lua/ngx/ssl
	$(INSTALL_DIR) $(1)/usr/lib/lua/resty/core
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/ngx/*.lua $(1)/usr/lib/lua/ngx
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/ngx/ssl/*.lua $(1)/usr/lib/lua/ngx/ssl
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/resty/*.lua $(1)/usr/lib/lua/resty
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-mod-lua-resty-core/lib/resty/core/*.lua $(1)/usr/lib/lua/resty/core
endef

define Download/nginx-mod-headers-more
  VERSION:=06dc0be56e5ec9f7fd814e881b066b5540a85bec
  URL:=https://github.com/openresty/headers-more-nginx-module.git
  MIRROR_HASH:=skip
  PROTO:=git
endef


define Download/nginx-mod-brotli
  VERSION:=25f86f0bac1101b6512135eac5f93c49c63609e3
  URL:=https://github.com/google/ngx_brotli.git
  MIRROR_HASH:=c85cdcfd76703c95aa4204ee4c2e619aa5b075cac18f428202f65552104add3b
  PROTO:=git
endef

define Download/nginx-mod-rtmp
  VERSION:=f0ea62342a4eca504b311cd5df910d026c3ea4cf
  URL:=https://github.com/ut0mt8/nginx-rtmp-module.git
  MIRROR_HASH:=d3f58066f0f858ed79f7f2b0c9b89de2ccc512c94ab3d0625f6dcff3df0b72c1
  PROTO:=git
endef

define Download/nginx-mod-ts
  VERSION:=ef2f874d95cc75747eb625a292524a702aefb0fd
  URL:=https://github.com/arut/nginx-ts-module.git
  MIRROR_HASH:=73938950bb286d40d9e54b0994d1a63827340c1156c72eb04d7041b25b20ec18
  PROTO:=git
endef

define Download/nginx-mod-naxsi
  VERSION:=d714f1636ea49a9a9f4f06dba14aee003e970834
  URL:=https://github.com/nbs-system/naxsi.git
  MIRROR_HASH:=bd006686721a68d43f052f0a4f00e9ff99fb2abfbc4dcf8194a3562fe4e5c08b
  PROTO:=git
endef

define Download/nginx-mod-lua
  VERSION:=c89469e920713d17d703a5f3736c9335edac22bf
  URL:=https://github.com/openresty/lua-nginx-module.git
  MIRROR_HASH:=dd66465f65c094a1ddfff2035bff4da870b7c6b7e033d307a9806a6df290a1a5
  PROTO:=git
endef

define Download/nginx-mod-lua-resty-core
  VERSION:=2e2b2adaa61719972fe4275fa4c3585daa0dcd84
  URL:=https://github.com/openresty/lua-resty-core.git
  MIRROR_HASH:=4bfc267fd027161f88fcbeacce38e6bd13ba894a581c2d6dfe78ee270b1a473c
  PROTO:=git
endef

define Download/nginx-mod-lua-resty-lrucache
  VERSION:=52f5d00403c8b7aa8a4d4f3779681976b10a18c1
  URL:=https://github.com/openresty/lua-resty-lrucache.git
  MIRROR_HASH:=618a972574b6b1db1eebf4046d9a471ac03ec092bb825136ba975928d4af2351
  PROTO:=git
endef

define Download/nginx-mod-dav-ext
  VERSION:=9f112cf8e396ea5e1bdc70cedfa4f5cbc48fe98a
  URL:=https://github.com/mid1221213/nginx-dav-ext-module.git
  MIRROR_HASH:=skip
  PROTO:=git
endef

define Download/nginx-mod-fancyindex
  VERSION:=6cdffdb0af493b7c21eedba2f09d8486579f3922
  URL:=https://github.com/aperezdc/ngx-fancyindex.git
  MIRROR_HASH:=skip
  PROTO:=git
endef

define Download/nginx-mod-ubus
  VERSION:=b2d7260dcb428b2fb65540edb28d7538602b4a26
  URL:=https://github.com/Ansuel/nginx-ubus-module.git
  MIRROR_HASH:=472cef416d25effcac66c85417ab6596e634a7a64d45b709bb090892d567553c
  PROTO:=git
endef

define Module/Download
  define Download/nginx-mod-$(1) +=

    SUBDIR:=nginx-mod-$(1)
    FILE:=nginx-mod-$(1)-$$$$(VERSION).tar.xz
  endef
endef
$(foreach m,$(PKG_MOD_EXTRA),$(eval $(call Module/Download,$(m))))

define Module/nginx-mod-naxsi/install
	$(INSTALL_DIR) $(1)/etc/nginx
	$(INSTALL_CONF) $(PKG_BUILD_DIR)/nginx-mod-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx
endef

define Quilt/Refresh/Package
	$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nginx,nginx/)
	$(foreach m,$(PKG_MOD_PATCHED),
		$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nginx-mod-$(m),nginx-mod-$(m)/)
	)
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/)
	$(foreach m,$(PKG_MOD_PATCHED),$(if $(or $(CONFIG_PACKAGE_nginx-mod-$(m)),$(QUILT)),
		$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/nginx-mod-$(m),nginx-mod-$(m)/)
	))
	$(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
endef

define Module/Build/Prepare
	$(eval $(call Download,nginx-mod-$(1)))
	$(eval $(Download/nginx-mod-$(1)))
	mkdir -p $(PKG_BUILD_DIR)/nginx-mod-$(1)
	xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR)/nginx-mod-$(1) $(TAR_OPTIONS) --strip-components 1
endef

define Build/Prepare
	rm -rf $(PKG_BUILD_DIR)
	mkdir -p $(PKG_BUILD_DIR)
	$(PKG_UNPACK)

	$(foreach m,$(filter-out $(PKG_MOD_PATCHED),$(PKG_MOD_EXTRA)),$(if $(CONFIG_PACKAGE_nginx-mod-$(m)),
		$(call Module/Build/Prepare,$(m))
	))
	$(foreach m,$(PKG_MOD_PATCHED),$(if $(or $(CONFIG_PACKAGE_nginx-mod-$(m)),$(QUILT)),
		$(call Module/Build/Prepare,$(m))
	))
	$(Build/Patch)
endef

# $(1) module name
# $(2) module additional dependency
# $(3) module so name (stripped of the finaly _module.so)
# $(4) module description
define BuildModule
  define Package/nginx-mod-$(1)
    $(call Package/nginx/default)
    DEPENDS:=+nginx-ssl $(2)
    TITLE:=Nginx $(1) module
  endef

  define Package/nginx-mod-$(1)/description
    $(strip $(4))
  endef

  define Package/nginx-mod-$(1)/install
	$(INSTALL_DIR) $$(1)/usr/lib/nginx/modules
	$(foreach m,$(3),
	  $(CP) $$(PKG_INSTALL_DIR)/usr/lib/nginx/modules/$(m)_module.so $$(1)/usr/lib/nginx/modules
	)
	$(call Module/nginx-mod-$(1)/install,$$(1))
  endef

  $$(eval $$(call BuildPackage,nginx-mod-$(1)))
endef

TARGET_CFLAGS += -DNGX_LUA_NO_BY_LUA_BLOCK

ifneq ($(CONFIG_PACKAGE_nginx-mod-lua),)
  CONFIGURE_VARS += LUAJIT_INC=$(STAGING_DIR)/usr/include/luajit-* \
					LUAJIT_LIB=$(STAGING_DIR)/usr/lib
endif

CONFIGURE_VARS += CONFIG_BIG_ENDIAN=$(CONFIG_BIG_ENDIAN)

CONFIGURE_ARGS += \
	--crossbuild=Linux::$(ARCH) \
	--prefix=/usr \
	--conf-path=/etc/nginx/nginx.conf \
	--modules-path=/usr/lib/nginx/modules \
	--error-log-path=stderr \
	--pid-path=/var/run/nginx.pid \
	--lock-path=/var/lock/nginx.lock \
	--http-log-path=/var/log/nginx/access.log \
	--http-client-body-temp-path=/var/lib/nginx/body \
	--http-proxy-temp-path=/var/lib/nginx/proxy \
	--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
	--with-cc="$(TARGET_CC)" \
	--with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
	--with-ld-opt="$(TARGET_LDFLAGS)" \
	--without-http_upstream_zone_module \
	--with-compat \
	--with-http_ssl_module \
	$(if $(call IsDisabled,NGINX_HTTP_CACHE),--without-http-cache) \
	$(if $(call IsDisabled,NGINX_PCRE),--without-pcre) \
	$(if $(call IsDisabled,NGINX_HTTP_CHARSET),--without-http_charset_module) \
	$(if $(call IsDisabled,NGINX_HTTP_GZIP),--without-http_gzip_module) \
	$(if $(call IsDisabled,NGINX_HTTP_SSI),--without-http_ssi_module) \
	$(if $(call IsDisabled,NGINX_HTTP_USERID),--without-http_userid_module) \
	$(if $(call IsDisabled,NGINX_HTTP_ACCESS),--without-http_access_module) \
	$(if $(call IsDisabled,NGINX_HTTP_AUTH_BASIC),--without-http_auth_basic_module) \
	$(if $(call IsDisabled,NGINX_HTTP_AUTOINDEX),--without-http_autoindex_module) \
	$(if $(call IsDisabled,NGINX_HTTP_GEO),--without-http_geo_module) \
	$(if $(call IsDisabled,NGINX_HTTP_MAP),--without-http_map_module) \
	$(if $(call IsDisabled,NGINX_HTTP_SPLIT_CLIENTS),--without-http_split_clients_module) \
	$(if $(call IsDisabled,NGINX_HTTP_REFERER),--without-http_referer_module) \
	$(if $(call IsDisabled,NGINX_HTTP_REWRITE),--without-http_rewrite_module) \
	$(if $(call IsDisabled,NGINX_HTTP_PROXY),--without-http_proxy_module) \
	$(if $(call IsDisabled,NGINX_HTTP_FASTCGI),--without-http_fastcgi_module) \
	$(if $(call IsDisabled,NGINX_HTTP_UWSGI),--without-http_uwsgi_module) \
	$(if $(call IsDisabled,NGINX_HTTP_SCGI),--without-http_scgi_module) \
	$(if $(call IsDisabled,NGINX_HTTP_MEMCACHED),--without-http_memcached_module) \
	$(if $(call IsDisabled,NGINX_HTTP_LIMIT_CONN),--without-http_limit_conn_module) \
	$(if $(call IsDisabled,NGINX_HTTP_LIMIT_REQ),--without-http_limit_req_module) \
	$(if $(call IsDisabled,NGINX_HTTP_EMPTY_GIF),--without-http_empty_gif_module) \
	$(if $(call IsDisabled,NGINX_HTTP_BROWSER),--without-http_browser_module) \
	$(if $(call IsDisabled,NGINX_HTTP_UPSTREAM_HASH),--without-http_upstream_hash_module) \
	$(if $(call IsDisabled,NGINX_HTTP_UPSTREAM_IP_HASH),--without-http_upstream_ip_hash_module) \
	$(if $(call IsDisabled,NGINX_HTTP_UPSTREAM_LEAST_CONN),--without-http_upstream_least_conn_module) \
	$(if $(call IsDisabled,NGINX_HTTP_UPSTREAM_KEEPALIVE),--without-http_upstream_keepalive_module) \
	$(if $(call IsEnabled,IPV6),--with-ipv6) \
	$(if $(call IsEnabled,NGINX_HTTP_GZIP_STATIC),--with-http_gzip_static_module --with-http_gunzip_module) \
	$(if $(call IsEnabled,NGINX_STUB_STATUS),--with-http_stub_status_module) \
	$(if $(call IsEnabled,NGINX_FLV),--with-http_flv_module) \
	$(if $(call IsEnabled,NGINX_MP4),--with-http_mp4_module) \
	$(if $(call IsEnabled,NGINX_DAV),--with-http_dav_module) \
	$(if $(call IsEnabled,NGINX_HTTP_ADDITION),--with-http_addition_module) \
	$(if $(call IsEnabled,NGINX_HTTP_AUTH_REQUEST),--with-http_auth_request_module) \
	$(if $(call IsEnabled,NGINX_HTTP_QUIC),--with-http_v3_module) \
	$(if $(call IsEnabled,NGINX_HTTP_V2),--with-http_v2_module) \
	$(if $(call IsEnabled,NGINX_HTTP_V2_AUTOTUNE),--with-http_v2_autotune_upload) \
	$(if $(call IsEnabled,NGINX_HTTP_REAL_IP),--with-http_realip_module) \
	$(if $(call IsEnabled,NGINX_HTTP_SECURE_LINK),--with-http_secure_link_module) \
	$(if $(call IsEnabled,NGINX_HTTP_SUB),--with-http_sub_module) \
	$(if $(CONFIG_PACKAGE_nginx-mod-stream),--with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module) \
	$(if $(call IsEnabled,NGINX_STREAM_REAL_IP),--with-stream_realip_module) \
	$(if $(CONFIG_PACKAGE_nginx-mod-naxsi),--add-dynamic-module=$(PKG_BUILD_DIR)/nginx-mod-naxsi/naxsi_src) \
	$(foreach m,$(filter-out lua-resty-core lua-resty-lrucache naxsi,$(PKG_MOD_EXTRA)), \
		$(if $(CONFIG_PACKAGE_nginx-mod-$(m)),--add-dynamic-module=$(PKG_BUILD_DIR)/nginx-mod-$(m)))

$(eval $(call BuildPackage,nginx-ssl))
$(eval $(call BuildPackage,nginx-full))
$(eval $(call BuildPackage,nginx-mod-luci))
$(eval $(call BuildPackage,nginx-mod-lua-resty-lrucache))
$(eval $(call BuildPackage,nginx-mod-lua-resty-core))
$(eval $(call BuildModule,stream,+@NGINX_STREAM_CORE_MODULE, \
	ngx_stream, Add support for NGINX request streaming.))
$(eval $(call BuildModule,lua,+nginx-mod-lua-resty-core,ngx_http_lua, \
	Enable Lua module (luajit2 based, OpenResty patches)))
$(eval $(call BuildModule,ubus,+libubus +libjson-c +libblobmsg-json +@NGINX_UBUS, \
	ngx_http_ubus,Enable UBUS api support directly from the server.))
$(eval $(call BuildModule,dav-ext,+@NGINX_DAV +libxml2,ngx_http_dav_ext, \
	Enable the WebDAV methods PROPFIND OPTIONS LOCK UNLOCK [mid1221213's fork].))
$(eval $(call BuildModule,fancyindex,+@NGINX_HTTP_ADDITION,../nginx-fancyindex, \
	Nginx Fancy Index module.))
$(eval $(call BuildModule,headers-more,,ngx_http_headers_more_filter, \
	Set and clear input and output headers...more than "add"!))
$(eval $(call BuildModule,rtmp,,ngx_rtmp, \
	Add support for NGINX-based Media Streaming Server module. DASH enhanced))
$(eval $(call BuildModule,ts,,ngx_http_ts, \
	Add support for MPEG-TS Live Module module.))
$(eval $(call BuildModule,brotli,,ngx_http_brotli_filter ngx_http_brotli_static, \
	Add support for brotli compression module.))
$(eval $(call BuildModule,digest,,ngx_http_auth_digest, \
	Add support for digest authentication.))
$(eval $(call BuildModule,naxsi,,ngx_http_naxsi, \
	Enable NAXSI module.))
$(eval $(call BuildModule,geoip2,+@NGINX_STREAM_CORE_MODULE +libmaxminddb,ngx_http_geoip2 ngx_stream_geoip2, \
	Enable MaxMind GeoIP2 module.))

# 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.

define Package/nginx
  TITLE:=Dummy package for transition when upgrading.
  DEPENDS:=+nginx-ssl
  PKGARCH:=all
endef

define Package/nginx/install
	$(INSTALL_DIR) $(1)/usr/bin
endef

$(eval $(call BuildPackage,nginx))

define Package/nginx-mod-luci-ssl
  TITLE:=Dummy package for transition when upgrading.
  DEPENDS:=+nginx-mod-luci
  PKGARCH:=all
endef

define Package/nginx-mod-luci-ssl/install
	$(INSTALL_DIR) $(1)/usr/bin
endef

$(eval $(call BuildPackage,nginx-mod-luci-ssl))

Config_ssl.in

#
# Copyright (C) 2010-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

menu "Configuration"
        depends on PACKAGE_nginx-ssl

config NGINX_DAV
	bool
	prompt "Enable WebDAV module"
	help
		Enable the HTTP and WebDAV methods PUT, DELETE, MKCOL, COPY and MOVE.
	default n

config NGINX_FLV
	bool
	prompt "Enable FLV module"
	help
		Provides the ability to seek within FLV (Flash) files using time-based offsets.
	default n

config NGINX_MP4
	bool
	prompt "Enable MP4 module"
	help
		Provides the ability to seek within mp4 files using time-based offsets.
	default n

config NGINX_STUB_STATUS
	bool
	prompt "Enable stub status module"
	help
		Enable the stub status module which gives some status from the server.
	default n

config NGINX_HTTP_CHARSET
	bool
	prompt "Enable HTTP charset module"
	default y

config NGINX_HTTP_GZIP
	bool
	prompt "Enable HTTP gzip module"
	default y

config NGINX_HTTP_GZIP_STATIC
	bool
	prompt "Enable HTTP gzip static module"
	default y

config NGINX_HTTP_SSI
	bool
	prompt "Enable HTTP ssi module"
	default y

config NGINX_HTTP_USERID
	bool
	prompt "Enable HTTP userid module"
	default y

config NGINX_HTTP_ACCESS
	bool
	prompt "Enable HTTP access module"
	default y

config NGINX_HTTP_AUTH_BASIC
	bool
	prompt "Enable HTTP auth basic"
	default y

config NGINX_HTTP_AUTH_REQUEST
	bool
	prompt "Enable HTTP auth request module"
	default n

config NGINX_HTTP_AUTOINDEX
	bool
	prompt "Enable HTTP autoindex module"
	default y

config NGINX_HTTP_GEO
	bool
	prompt "Enable HTTP geo module"
	default y

config NGINX_HTTP_MAP
	bool
	prompt "Enable HTTP map module"
	default y

config NGINX_HTTP_SPLIT_CLIENTS
	bool
	prompt "Enable HTTP split clients"
	default y

config NGINX_HTTP_REFERER
	bool
	prompt "Enable HTTP referer module"
	default y

config NGINX_HTTP_REWRITE
	bool
	prompt "Enable HTTP rewrite module"
	select NGINX_PCRE
	default y

config NGINX_HTTP_PROXY
	bool
	prompt "Enable HTTP proxy module"
	default y

config NGINX_HTTP_FASTCGI
	bool
	prompt "Enable HTTP fastcgi module"
	default y

config NGINX_HTTP_UWSGI
	bool
	prompt "Enable HTTP uwsgi module"
	default y

config NGINX_HTTP_SCGI
	bool
	prompt "Enable HTTP scgi module"
	default y

config NGINX_HTTP_MEMCACHED
	bool
	prompt "Enable HTTP memcached module"
	default y

config NGINX_HTTP_LIMIT_CONN
	bool
	prompt "Enable HTTP limit conn"
	default y

config NGINX_HTTP_LIMIT_REQ
	bool
	prompt "Enable HTTP limit req"
	default y

config NGINX_HTTP_EMPTY_GIF
	bool
	prompt "Enable HTTP empty gif"
	default y

config NGINX_HTTP_BROWSER
	bool
	prompt "Enable HTTP browser module"
	default y

config NGINX_HTTP_UPSTREAM_HASH
	bool
	prompt "Enable HTTP hash module"
	default y

config NGINX_HTTP_UPSTREAM_IP_HASH
	bool
	prompt "Enable HTTP IP hash module"
	default y

config NGINX_HTTP_UPSTREAM_LEAST_CONN
	bool
	prompt "Enable HTTP least conn module"
	default y

config NGINX_HTTP_UPSTREAM_KEEPALIVE
	bool
	prompt "Enable HTTP keepalive module"
	default y

config NGINX_HTTP_CACHE
	bool
	prompt "Enable HTTP cache"
	default y

config NGINX_HTTP_V2
	bool
	prompt "Enable HTTP_V2 module"
	default y

config NGINX_HTTP_V2_AUTOTUNE
	bool
	prompt "Cloudflare HTTP/2 autotuning request body buffer"
	default y

config NGINX_HTTP_QUIC
	bool
	prompt "Enable QUIC support"
	default n

config NGINX_HTTP_ADDITION
	bool
	prompt "Enable HTTP Addition (filter that adds text before and after a response)"
	default n

config NGINX_PCRE
	bool
	prompt "Enable PCRE library usage"
	default y

config NGINX_HTTP_REAL_IP
	bool
	prompt "Enable HTTP real ip module"
	default n

config NGINX_HTTP_SECURE_LINK
	bool
	prompt "Enable HTTP secure link module"
	default n

config NGINX_HTTP_SUB
	bool
	prompt "Enable HTTP sub module"
	default n

config NGINX_STREAM_REAL_IP
	bool
	prompt "Enable STREAM real ip module"
	default n

endmenu

Remark: Here is the patch for http2-autotune: https://mailman.nginx.org/pipermail/nginx-devel/2020-August/013436.html

alex9434 avatar Mar 25 '24 03:03 alex9434

You need to fix your build directory. You are building v22 package tree on v23. See: https://github.com/openwrt/packages/blob/53896bd1a7cf7d886cafcd42178d58ada4d6e697/net/nginx/Makefile#L11 https://github.com/openwrt/packages/blob/1f10633db02f03b4e4f18cb83ca94fc838dc985d/net/nginx/Makefile#L11

brada4 avatar Mar 25 '24 05:03 brada4

Hi @brada4 I used the the Makefile from staging because it creates dynamic modules with --add-dynamic-module. The older Makefile from stable that you linked to does not do that and statically includes all modules in the executable with --add-module. The fancyindex module also does not compile with the version 1.25.0 of Nignx from the original staging makefile that you linked to.

As I said, all other dynamic modules except for fancyindex work fine with this makefile. Fancyindex explicitly states that "since version 0.4.0, the module can also be built as a dynamic module using --add-dynamic-module. Therefore I assume that it is caused by something that is specific to fancyindex.

alex9434 avatar Mar 25 '24 05:03 alex9434

Im afraid you go to forums. To request new package/option you have to provide a working PR.

brada4 avatar Mar 25 '24 12:03 brada4