Add $host variable for fastcgi_params et proxy_params (#666)

* Fix install script version check

* Add $host variable for fastcgi_params et proxy_params

* Add "$http3" variable to logs

* Bump release to v3.21.2

* Another fix for wildcard certificates
This commit is contained in:
VirtuBox
2024-06-11 23:52:12 +02:00
committed by GitHub
parent 03fd15d484
commit be929e19a2
8 changed files with 50 additions and 16 deletions

View File

@@ -8,6 +8,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.22.0 - [Unreleased] ### v3.22.0 - [Unreleased]
### v3.21.2 - 2024-06-11
#### Added
- "$http3" variable in access_logs
#### Fixed
- $host variable for fastcgi_params et proxy_params
### v3.21.1 - 2024-06-11 ### v3.21.1 - 2024-06-11
#### Fixed #### Fixed

View File

@@ -9,7 +9,7 @@
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# wget -qO wo wops.cc && sudo -E bash wo # wget -qO wo wops.cc && sudo -E bash wo
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Version 3.21.1 - 2024-06-11 # Version 3.21.2 - 2024-06-11
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# CONTENTS # CONTENTS

View File

@@ -27,7 +27,7 @@ if os.geteuid() == 0:
os.makedirs('/var/lib/wo/tmp/') os.makedirs('/var/lib/wo/tmp/')
setup(name='wordops', setup(name='wordops',
version='3.21.1', version='3.21.2',
description='An essential toolset that eases server administration', description='An essential toolset that eases server administration',
long_description=LONG, long_description=LONG,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',

View File

@@ -11,6 +11,7 @@ from wo.core.shellexec import WOShellExec
from wo.core.variables import WOVar from wo.core.variables import WOVar
from wo.cli.plugins.sitedb import (getAllsites) from wo.cli.plugins.sitedb import (getAllsites)
from wo.core.template import WOTemplate from wo.core.template import WOTemplate
from wo.core.domainvalidate import WODomain
class WOStackMigrateController(CementBaseController): class WOStackMigrateController(CementBaseController):
@@ -118,13 +119,23 @@ class WOStackMigrateController(CementBaseController):
for site in allsites: for site in allsites:
if not site: if not site:
pass pass
if (os.path.exists(f'/var/www/{site.sitename}/conf/nginx/ssl.conf') and if os.path.exists(f'/var/www/{site.sitename}/conf/nginx/ssl.conf'):
not os.path.islink(f'/var/www/{site.sitename}/conf/nginx/ssl.conf')): if not os.path.islink(f'/var/www/{site.sitename}/conf/nginx/ssl.conf'):
data = dict(ssl_live_path=WOVar.wo_ssl_live, data = dict(ssl_live_path=WOVar.wo_ssl_live,
domain=site.sitename, quic=True) domain=site.sitename, quic=True)
WOTemplate.deploy( WOTemplate.deploy(
self, f'/var/www/{site.sitename}/conf/nginx/ssl.conf', self, f'/var/www/{site.sitename}/conf/nginx/ssl.conf',
'ssl.mustache', data, overwrite=True) 'ssl.mustache', data, overwrite=True)
else:
(_, wo_root_domain) = WODomain.getlevel(
self, site.sitename)
if (site.sitename != wo_root_domain and
os.path.exists(f'/etc/letsencrypt/shared/{wo_root_domain}.conf')):
data = dict(ssl_live_path=WOVar.wo_ssl_live,
domain=wo_root_domain, quic=True)
WOTemplate.deploy(
self, f'/etc/letsencrypt/shared/{wo_root_domain}.conf',
'ssl.mustache', data, overwrite=True)
post_pref(self, WOVar.wo_nginx, []) post_pref(self, WOVar.wo_nginx, [])
@expose(hide=True) @expose(hide=True)

View File

@@ -149,6 +149,19 @@ def post_pref(self, apt_packages, packages, upgrade=False):
encoding='utf-8', mode='a') as wo_nginx: encoding='utf-8', mode='a') as wo_nginx:
wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n') '\t$request_filename;\n')
if not WOFileUtils.grep(self, '/etc/nginx/fastcgi_params',
'HTTP_HOST'):
WOFileUtils.textappend(self, '/etc/nginx/fastcgi_params',
'# Fix for HTTP/3 QUIC HTTP_HOST\n'
'fastcgi_param\tHTTP_HOST\t$host;\n')
if not WOFileUtils.grep(self, '/etc/nginx/proxy_params',
'X-Forwarded-Host'):
WOFileUtils.textappend(self, '/etc/nginx/proxy_params',
'proxy_set_header X-Forwarded-Host $host;\n')
if not WOFileUtils.grep(self, '/etc/nginx/proxy_params',
'X-Forwarded-Port'):
WOFileUtils.textappend(self, '/etc/nginx/proxy_params',
'proxy_set_header X-Forwarded-Port $server_port;\n')
try: try:
data = dict(php="9000", debug="9001", data = dict(php="9000", debug="9001",
php7="9070", debug7="9170", php7="9070", debug7="9170",
@@ -245,7 +258,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"$upstream_response_time " "$upstream_response_time "
"$srcache_fetch_status " "$srcache_fetch_status "
"[$time_local] '\n" "[$time_local] '\n"
"'$http_host \"$request\" $status" "'$host \"$request\" $status"
" $body_bytes_sent '\n" " $body_bytes_sent '\n"
"'\"$http_referer\" " "'\"$http_referer\" "
"\"$http_user_agent\"';\n") "\"$http_user_agent\"';\n")
@@ -884,7 +897,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"# Log format Settings\n" "# Log format Settings\n"
"log_format rt_cache_redis '$remote_addr " "log_format rt_cache_redis '$remote_addr "
"$upstream_response_time $srcache_fetch_status " "$upstream_response_time $srcache_fetch_status "
"[$time_local] '\n '$http_host \"$request\" " "[$time_local] '\n '$host \"$request\" "
"$status $body_bytes_sent '\n'\"$http_referer\" " "$status $body_bytes_sent '\n'\"$http_referer\" "
"\"$http_user_agent\"';\n") "\"$http_user_agent\"';\n")
# set redis.conf parameter # set redis.conf parameter

View File

@@ -94,8 +94,8 @@ http {
# Log format Settings # Log format Settings
log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] '
'$http_host "$request" $status $body_bytes_sent ' '$host "$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$server_protocol"'; '"$http_referer" "$http_user_agent" "$server_protocol" "$http3"';
## ##
# Virtual Host Configs # Virtual Host Configs

View File

@@ -48,8 +48,8 @@ error_log /var/log/nginx/error.log;
# Log format Settings # Log format Settings
log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] '
'$http_host "$request" $status $body_bytes_sent ' '$host "$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$request_body"'; '"$http_referer" "$http_user_agent" "$request_body" "$http3"';
## ##
# Gzip Settings # Gzip Settings

View File

@@ -15,7 +15,7 @@ class WOVar():
"""Intialization of core variables""" """Intialization of core variables"""
# WordOps version # WordOps version
wo_version = "3.21.1" wo_version = "3.21.2"
# WordOps packages versions # WordOps packages versions
wo_adminer = "4.8.1" wo_adminer = "4.8.1"
wo_phpmyadmin = "5.2.0" wo_phpmyadmin = "5.2.0"