From 5d23f649e150dc2c28e0881b8525e3c049ed74a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Fri, 3 Jun 2022 11:38:54 -0600 Subject: [PATCH] minor fixes Server reset not reloading Nginx. Reverse proxy unix sockets improved. --- lib/install | 1 + lib/sites | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/install b/lib/install index bdec25e..9a49bb5 100644 --- a/lib/install +++ b/lib/install @@ -368,6 +368,7 @@ location = /xmlrpc.php { conf_write server-version $svr_version conf_write nginx-optim true + sudo systemctl reload nginx api-events_update in10 echo "${gre}Nginx has been successfully Optimized by Webinoly! ${end}" } diff --git a/lib/sites b/lib/sites index 46f38b0..6a26749 100644 --- a/lib/sites +++ b/lib/sites @@ -1254,12 +1254,12 @@ reverse_proxy() { fi is_url $proxydata -split - [[ -z $url_scheme ]] && proxydata="http://${proxydata}" + [[ -z $url_scheme || ${url_scheme,,} == "unix" ]] && proxydata="http://${proxydata}" # URI part (subfolders) are not allowed because the proxy configuration we are using includes the static files location # This location block is using regex which is not allowed, dedicated reverse proxy are not affected because they don't have static file location block. # nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/apps.d/testa.qrokes.com-proxy.conf:31 - if [[ -z $dedicated_reverse_proxy && -n $url_path && $url_path != "/" ]]; then + if [[ -z $dedicated_reverse_proxy && -n $url_path ]]; then echo "${red}[ERROR] Subfolders in your endpoint are not allowed in Reverse Proxy sites configured as websites!${end}" exit 1 fi @@ -1289,13 +1289,13 @@ reverse_proxy() { [[ $(is_ssl $domain) != "true" ]] && sudo sed -i '/CacheStaticFiles/,/expires max;/{/headers-https.conf;/d}' /etc/nginx/apps.d/$domain$subname-proxy.conf # Suggest / at the end of the url to pass - if [[ -n $dedicated_reverse_proxy && $(echo "${rpurl}" | rev | cut -c-1) != "/" ]]; then + if [[ -n $dedicated_reverse_proxy && $(echo "${proxydata}" | rev | cut -c-1) != "/" ]]; then echo "${dim}[INFO] Your endpoint URL doesn't have a / at the end! You should note that it can have a different behavior." echo "Read: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass ${end}" fi # Check host and port - local code=$(wget -t 1 --timeout=5 --server-response --spider $rpurl 2>&1 | awk '/^ HTTP/{print $2}') + local code=$(wget -t 1 --timeout=5 --server-response --spider $proxydata 2>&1 | awk '/^ HTTP/{print $2}') code="${code##*$'\n'}" [[ -n $code ]] && local mes="(Code: ${code})" [[ $code =~ ^(2|3|4)[0-9][0-9]$ ]] || echo "${red}[WARNING] Seems like your Reverse Proxy host is not responding! ${mes}${end}"