11#! /bin/bash
22# info: Add FastCGI nginx support
3- # options: USER DOMAIN [LENTGH ] [DEBUG] [RESTART]
3+ # options: USER DOMAIN [DURATION ] [DEBUG] [RESTART]
44# labels: hestia web
55#
66# example: v-add-fastcgi-cache user domain.tld 30m
77#
88# The function enables FastCGI cache for nginx
9- # For Length only use time in seconds (10s) minutes (10m) or days (10d)
9+ # Acceptable values for duration is time in seconds (10s) minutes (10m) or days (10d)
1010# Add "yes" as last parameter to append debug information to response headers
1111
1212# ----------------------------------------------------------#
1616# Argument definition
1717user=$1
1818domain=$2
19- length =${3-30m}
19+ duration =${3-30m}
2020debug=${4-no}
2121restart=${5-no}
2222
@@ -36,8 +36,8 @@ is_object_unsuspended 'user' 'USER' "$user"
3636is_object_valid ' web' ' DOMAIN' " $domain "
3737is_object_unsuspended ' web' ' DOMAIN' " $domain "
3838
39- if ! [[ " $length " =~ ^[0-9].* [s| m| d]$ ]]; then
40- echo " Invalid length " ;
39+ if ! [[ " $duration " =~ ^[0-9].* [s| m| d]$ ]]; then
40+ echo " Invalid duration " ;
4141 exit 2;
4242fi
4343# Perform verification if read-only mode is enabled
@@ -51,7 +51,7 @@ check_hestia_demo_mode
5151# Load domain data
5252parse_object_kv_list $( grep " DOMAIN='$domain '" $USER_DATA /web.conf)
5353
54- # Check if nginx is not in proxy mode
54+ # Check that nginx is not in proxy mode
5555if [ " $WEB_SYSTEM " != ' nginx' ]; then
5656 echo " Error: nginx is in proxy mode"
5757 exit $E_NOTEXIST
@@ -103,13 +103,13 @@ mkdir -p /var/cache/nginx/micro/$domain
103103if [ -z " $FASTCGI_CACHE " ]; then
104104 add_object_key " web" ' DOMAIN' " $domain " ' FASTCGI_CACHE' ' ALIAS'
105105fi
106- if [ -z " $FASTCGI_LENGTH " ]; then
107- add_object_key " web" ' DOMAIN' " $domain " ' FASTCGI_LENGTH ' ' ALIAS'
106+ if [ -z " $FASTCGI_DURATION " ]; then
107+ add_object_key " web" ' DOMAIN' " $domain " ' FASTCGI_DURATION ' ' ALIAS'
108108fi
109109
110110# Set FastCGI cache flag to enabled
111111update_object_value ' web' ' DOMAIN' " $domain " ' $FASTCGI_CACHE' ' yes'
112- update_object_value ' web' ' DOMAIN' " $domain " ' FASTCGI_LENGTH ' " $length "
112+ update_object_value ' web' ' DOMAIN' " $domain " ' FASTCGI_DURATION ' " $duration "
113113
114114if [ " $restart " = " yes" ]; then
115115 # Restart web server
0 commit comments