@@ -110,18 +110,35 @@ def add_repo_key(url, keyring_path):
110110 )
111111
112112def nginx_install_script (channel = 'stable' ):
113- """Nginx official install script for all distros"""
113+ """Nginx official install script for all distros.
114+ Also:
115+ - Opens UDP 443 in firewall (required for HTTP/3 QUIC)
116+ - Adds stream {} block to nginx.conf (required for TCP load balancing)
117+ """
114118 os_info = get_os ()
119+ stream_setup = (
120+ # Add stream block if missing — needed for TCP LB
121+ 'grep -q "^stream" /etc/nginx/nginx.conf 2>/dev/null || '
122+ 'echo -e "\\ nstream {\\ n include /etc/nginx/stream.d/*.conf;\\ n}" >> /etc/nginx/nginx.conf; '
123+ 'mkdir -p /etc/nginx/stream.d; '
124+ # Open UDP 443 for HTTP/3 QUIC — idempotent
125+ '(ufw status 2>/dev/null | grep -q "Status: active" && ufw allow 443/udp 2>/dev/null); '
126+ '(firewall-cmd --state 2>/dev/null | grep -q running && '
127+ 'firewall-cmd --add-port=443/udp --permanent 2>/dev/null && '
128+ 'firewall-cmd --reload 2>/dev/null); '
129+ 'true'
130+ )
115131 if os_info ['family' ] == 'debian' :
116132 repo = 'http://nginx.org/packages/ubuntu' if channel == 'stable' else 'http://nginx.org/packages/mainline/ubuntu'
117133 return (
118134 f'curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --batch --no-tty --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg && '
119135 f'echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] { repo } { os_info ["codename" ]} nginx" > /etc/apt/sources.list.d/nginx.list && '
120136 f'{ pkg_update ()} && '
121137 f'{ pkg_install ("nginx" )} && '
122- f'systemctl enable nginx && systemctl start nginx'
138+ f'systemctl enable nginx && systemctl start nginx && '
139+ f'{ stream_setup } '
123140 )
124- elif os_info ['family' ] in ('rhel' ,'fedora' ):
141+ elif os_info ['family' ] in ('rhel' , 'fedora' ):
125142 return (
126143 f'cat > /etc/yum.repos.d/nginx.repo << EOF\n '
127144 f'[nginx-{ channel } ]\n '
@@ -132,9 +149,13 @@ def nginx_install_script(channel='stable'):
132149 f'gpgkey=https://nginx.org/keys/nginx_signing.key\n '
133150 f'EOF\n '
134151 f'{ pkg_install ("nginx" )} && '
135- f'systemctl enable nginx && systemctl start nginx'
152+ f'systemctl enable nginx && systemctl start nginx && '
153+ f'{ stream_setup } '
136154 )
137- return f'{ pkg_install ("nginx" )} && systemctl enable nginx && systemctl start nginx'
155+ return (
156+ f'{ pkg_install ("nginx" )} && systemctl enable nginx && systemctl start nginx && '
157+ f'{ stream_setup } '
158+ )
138159
139160def php_install_script (ver ):
140161 """PHP install script for all distros"""
@@ -271,9 +292,10 @@ def docker_install_script():
271292 )
272293 return 'curl -fsSL https://get.docker.com | sh && systemctl enable docker && systemctl start docker'
273294
274- def nodejs_install_script (ver = '22 ' ):
295+ def nodejs_install_script (ver = '24 ' ):
275296 """Node.js official install script for all distros"""
276297 return (
298+ f'rm -f /etc/apt/sources.list.d/nodesource.list /usr/share/keyrings/nodesource.gpg /usr/share/keyrings/nodesource-repo.gpg 2>/dev/null; '
277299 f'curl -fsSL https://deb.nodesource.com/setup_{ ver } .x | bash - 2>/dev/null || '
278300 f'curl -fsSL https://rpm.nodesource.com/setup_{ ver } .x | bash - 2>/dev/null; '
279301 f'{ pkg_install ("nodejs" )} '
0 commit comments