fix: update Dockerfile and init-nginx.sh for improved nginx control error handling

This commit is contained in:
Jacky 2025-05-03 07:45:50 +00:00
parent a4c11d521d
commit 855c3375f8
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
3 changed files with 59 additions and 7 deletions

View file

@ -32,8 +32,5 @@ RUN cp -rp /etc/nginx /etc/nginx.orig
# Set PATH to include Go installation and default go install binary location
ENV PATH="/usr/local/go/bin:/root/go/bin:${PATH}"
# Install air with go install (requires Go 1.23 or higher)
RUN go install github.com/air-verse/air@latest
# set zsh as default shell
RUN chsh -s $(which zsh)

View file

@ -1,3 +1,4 @@
#!/bin/bash
# init nginx config dir
if [ "$(ls -A /etc/nginx)" = "" ]; then
echo "Initialing Nginx config dir"
@ -5,5 +6,51 @@ if [ "$(ls -A /etc/nginx)" = "" ]; then
echo "Initialed Nginx config dir"
fi
src_dir="/usr/share/nginx/modules-available"
dest_dir="/etc/nginx/modules-enabled"
create_symlink() {
local module_name=$1
local weight=$2
local target="$dest_dir/$weight-$module_name"
local source="$src_dir/$module_name"
ln -sf "$source" "$target"
echo "Created symlink: $target -> $source"
}
modules=(
"mod-http-ndk.conf 10"
"mod-http-auth-pam.conf 50"
"mod-http-cache-purge.conf 50"
"mod-http-dav-ext.conf 50"
"mod-http-echo.conf 50"
"mod-http-fancyindex.conf 50"
"mod-http-geoip.conf 50"
"mod-http-geoip2.conf 50"
"mod-http-headers-more-filter.conf 50"
"mod-http-image-filter.conf 50"
"mod-http-lua.conf 50"
"mod-http-perl.conf 50"
"mod-http-subs-filter.conf 50"
"mod-http-uploadprogress.conf 50"
"mod-http-upstream-fair.conf 50"
"mod-http-xslt-filter.conf 50"
"mod-mail.conf 50"
"mod-nchan.conf 50"
"mod-stream.conf 50"
"mod-stream-geoip.conf 70"
"mod-stream-geoip2.conf 70"
)
for module in "${modules[@]}"; do
module_name=$(echo $module | awk '{print $1}')
weight=$(echo $module | awk '{print $2}')
create_symlink "$module_name" "$weight"
done
# start nginx
nginx