From 7e57113be23de28cb1bcfbf0c710e8ac97ced201 Mon Sep 17 00:00:00 2001 From: Albrecht Lohofener Date: Fri, 28 Mar 2025 14:27:51 +0100 Subject: [PATCH] Remove obsolete u-OS nginx configuration --- src/init_container.sh | 14 ++--- src/run_openwrt.sh | 2 + .../{nginx.conf.generic => nginx.conf} | 0 web-frontend/nginx.conf.u-os-app | 54 ------------------- 4 files changed, 5 insertions(+), 65 deletions(-) rename web-frontend/{nginx.conf.generic => nginx.conf} (100%) delete mode 100644 web-frontend/nginx.conf.u-os-app diff --git a/src/init_container.sh b/src/init_container.sh index 6c673a6..69aea49 100644 --- a/src/init_container.sh +++ b/src/init_container.sh @@ -31,15 +31,6 @@ if [ ! -d "$STORAGE" ]; then error "Storage folder ($STORAGE) not found!" && exit 13 fi -# Check u-OS app -if [[ -z "${IS_U_OS_APP}" ]]; then - info "Detected generic container" - cp -f /var/www/nginx.conf.generic /etc/nginx/http.d/web.conf -else - info "Detected u-OS app" - cp -f /var/www/nginx.conf.u-os-app /etc/nginx/http.d/web.conf -fi - # Generate page for meta information echo "* Content of /var/vm/openwrt_metadata.conf *" > /var/www/system_info.txt cat /var/vm/openwrt_metadata.conf >> /var/www/system_info.txt @@ -61,6 +52,7 @@ lspci >> /var/www/system_info.txt set -e # Revert set +a # ******* nginx handling ******* +cp -f /var/www/nginx.conf /etc/nginx/http.d/web.conf cp -r /var/www/* /run/shm # ******* LuCi forwarding handling ******* @@ -77,12 +69,12 @@ else if [[ $FORWARD_LUCI = "true" ]]; then warn "LuCI forwarding is only available if environment variable is set to LAN_IF: 'veth'. Currently LAN_IF=$LAN_IF." fi - LUCI_COMMAND="sh -c 'sleep infinity'" # TODO: Find something better. Multirun needs something to run. + LUCI_COMMAND="sh -c 'sleep infinity'" # TODO: Find something better. Multirun needs something to run. fi # ******* OpenWrt run command after boot handling ******* if [[ -z "${OPENWRT_AFTER_BOOT_CMD}" ]]; then - OPENWRT_MULTIRUN_CMD="sh -c 'sleep infinity'" # TODO: Find something better. Multirun needs something to run. + OPENWRT_MULTIRUN_CMD="sh -c 'sleep infinity'" # TODO: Find something better. Multirun needs something to run. else info "Invoke command '${OPENWRT_AFTER_BOOT_CMD}' into OpenWrt after it is booted" OPENWRT_MULTIRUN_CMD="/run/run_command_after_openwrt_boot.sh '${OPENWRT_AFTER_BOOT_CMD}'" diff --git a/src/run_openwrt.sh b/src/run_openwrt.sh index 3618073..efa3f67 100755 --- a/src/run_openwrt.sh +++ b/src/run_openwrt.sh @@ -103,6 +103,8 @@ attach_veth_if () { # Only as u-OS app if [[ -n "${IS_U_OS_APP}" ]]; then + info "Detected u-OS app" + # Check if u-OS webserver is already configured if ! nsenter --target 1 --uts --net --ipc --mount grep -q "app-openwrt0" "/usr/lib/uc-http-server/ucu.yml" ; then info "Adding app-openwrt0 to /usr/lib/uc-http-server/ucu.yml ..." diff --git a/web-frontend/nginx.conf.generic b/web-frontend/nginx.conf similarity index 100% rename from web-frontend/nginx.conf.generic rename to web-frontend/nginx.conf diff --git a/web-frontend/nginx.conf.u-os-app b/web-frontend/nginx.conf.u-os-app deleted file mode 100644 index af8b378..0000000 --- a/web-frontend/nginx.conf.u-os-app +++ /dev/null @@ -1,54 +0,0 @@ -server { - - listen 80; - listen [::]:80; - listen 8006 default_server; - listen [::]:8006 default_server; - - autoindex on; - tcp_nodelay on; - server_tokens off; - absolute_redirect off; - - error_log /dev/null; - access_log /dev/null; - - include /etc/nginx/mime.types; - - gzip on; - gzip_vary on; - gzip_proxied any; - gzip_comp_level 5; - gzip_min_length 500; - gzip_disable "msie6"; - gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; - - add_header Cache-Control "no-cache"; - - location / { - root /var/www/browser; - try_files $uri $uri/ /index.html; - } - - location /websockify { - - proxy_http_version 1.1; - - proxy_set_header Connection 'upgrade'; - proxy_set_header Upgrade $http_upgrade; - - proxy_buffering off; - proxy_read_timeout 3600s; - proxy_send_timeout 3600s; - - proxy_pass http://127.0.0.1:5700/; - } - - location /api/ { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_pass http://127.0.0.1:8080/; - } - -}