Skip to content

Commit

Permalink
nginx: use UCI configuration provided by nginx-util
Browse files Browse the repository at this point in the history
* remove default configuration files and documentation as
  they are in the package `nginx-util`.

* do not install a `/etc/nginx/nginx.conf` file.

* use the dynamic `/etc/nginx/uci.conf` if the symlink (to
  `/var/lib/nginx/uci.conf`) is not dead after calling
  `nginx-util init_lan` (else try `/etc/nginx/nginx.conf`)
  and check the selected file by `nginx -t` when starting
  or reloading through init.d.

Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
  • Loading branch information
peter-stadler committed Jul 23, 2020
1 parent cf412c1 commit 4bbc7f2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 371 deletions.
15 changes: 6 additions & 9 deletions net/nginx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=nginx
PKG_VERSION:=1.19.1
PKG_RELEASE:=2
PKG_RELEASE:=3

PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://nginx.org/download/
Expand Down Expand Up @@ -96,6 +96,7 @@ endef
define Package/nginx-ssl
$(Package/nginx/default)
TITLE += with SSL support
EXTRA_DEPENDS:=nginx-ssl-util$(if $(CONFIG_NGINX_PCRE),,-nopcre) (>=1.5-1) (<2)
VARIANT:=ssl
CONFLICTS:=nginx-all-module
endef
Expand All @@ -109,6 +110,7 @@ define Package/nginx-all-module
TITLE += with ALL module selected
DEPENDS:=+libpcre +libopenssl +zlib +liblua +libpthread +libxml2 \
+libubus +libblobmsg-json +libjson-c +nginx-ssl-util
EXTRA_DEPENDS:=nginx-ssl-util (>=1.5-1) (<2)
VARIANT:=all-module
PROVIDES += nginx-ssl
endef
Expand Down Expand Up @@ -352,8 +354,6 @@ define Package/nginx-ssl/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
$(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
$(INSTALL_CONF) ./files/nginx.conf $(1)/etc/nginx/
$(INSTALL_CONF) ./files/_lan.conf $(1)/etc/nginx/conf.d/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
ifeq ($(CONFIG_NGINX_NAXSI),y)
Expand All @@ -363,10 +363,6 @@ ifeq ($(CONFIG_NGINX_NAXSI),y)
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))
$(INSTALL_CONF) ./files/_redirect2ssl.conf $(1)/etc/nginx/conf.d/
ifneq ($(CONFIG_IPV6),y)
$(SED) '/listen\s*\[/d' $(1)/etc/nginx/conf.d/*.conf # without IPv6 [::]
endif
endef

Package/nginx-all-module/install = $(Package/nginx-ssl/install)
Expand All @@ -376,8 +372,9 @@ define Package/nginx-ssl/prerm
[ -z "$${IPKG_INSTROOT}" ] || exit 0
[ "$${PKG_UPGRADE}" = "1" ] && exit 0
eval $$(/usr/bin/nginx-util get_env)
rm -f "$${CONF_DIR}$${LAN_NAME}.crt"
rm -f "$${CONF_DIR}$${LAN_NAME}.key"
[ "$$(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

Expand Down
304 changes: 0 additions & 304 deletions net/nginx/files/README.sh

This file was deleted.

12 changes: 0 additions & 12 deletions net/nginx/files/_lan.conf

This file was deleted.

8 changes: 0 additions & 8 deletions net/nginx/files/_redirect2ssl.conf

This file was deleted.

0 comments on commit 4bbc7f2

Please sign in to comment.