Add option to create a static (Non PHP) vhost entry. Add Option to allow only https-connections.
This commit is contained in:
parent
b2a740b118
commit
534a3c7e49
@ -48,8 +48,12 @@ cat<<EOF
|
||||
created.
|
||||
|
||||
-t <type>
|
||||
One of "PHP-FPM", "FCGID" or "MOD_PHP"
|
||||
One of "PHP-FPM", "FCGID", "MOD_PHP" or "STATIC".
|
||||
If not give, the site url will be requested.
|
||||
|
||||
-s
|
||||
Only https connections allowed. Non SSL connections will be redirected
|
||||
to SSL connection
|
||||
|
||||
-S <unix socket for php-fpm>
|
||||
Only used if type is php-fpm ("-t PHP-FPM").
|
||||
@ -247,6 +251,7 @@ _type=""
|
||||
_COMMON_FCGID_CONFIG_PATH=""
|
||||
major_php_verison=""
|
||||
_print_summary=true
|
||||
_https_only=""
|
||||
_symlink_web_base_dir=""
|
||||
|
||||
CREATE_PHPINFO_FILE=true
|
||||
@ -303,6 +308,7 @@ while getopts aChl:n:p:sS:t:u:V:v: opt ; do
|
||||
fi
|
||||
;;
|
||||
q) _print_summary=false ;;
|
||||
s) _https_only=true ;;
|
||||
S) if [ -n "$OPTARG" -a -S "$OPTARG" ]; then
|
||||
unix_socket=$OPTARG
|
||||
connection="unix_socket"
|
||||
@ -384,20 +390,24 @@ if $USE_PROJECT_NAME && [[ -z "$PROJECT_NAME" ]]; then
|
||||
read PROJECT_NAME
|
||||
done
|
||||
fi
|
||||
if [[ "$PROJECT_NAME" = "PARKED" ]] ; then
|
||||
_type="STATIC"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "\033[32m--\033[m"
|
||||
echo ""
|
||||
if [ "$_type" != "PHP-FPM" -a "$_type" != "FCGID" -a "$_type" != "MOD_PHP" ];then
|
||||
if [ "$_type" != "PHP-FPM" -a "$_type" != "FCGID" -a "$_type" != "MOD_PHP" -a "$_type" != "STATIC" ];then
|
||||
echo "Select PHP implementation configure for ?"
|
||||
echo ""
|
||||
echo "[1] PHP-FPM (FastCGI Process Manager)"
|
||||
echo "[2] mod_fcgid (Apache FastCGI implementation)"
|
||||
echo "[3] mod_php (Apache PHP Module)"
|
||||
echo "[4] suEXEC ( using mod_fcgid)"
|
||||
echo "[4] suEXEC (using mod_fcgid)"
|
||||
echo "[5] static site (No PHP engine enabled)"
|
||||
echo ""
|
||||
echononl "Your choice: "
|
||||
while [ "$_type" != "PHP-FPM" -a "$_type" != "FCGID" -a "$_type" != "MOD_PHP" ];do
|
||||
while [ "$_type" != "PHP-FPM" -a "$_type" != "FCGID" -a "$_type" != "MOD_PHP" -a "$_type" != "STATIC" ];do
|
||||
read OPTION
|
||||
case $OPTION in
|
||||
1) _type="PHP-FPM"
|
||||
@ -417,8 +427,12 @@ if [ "$_type" != "PHP-FPM" -a "$_type" != "FCGID" -a "$_type" != "MOD_PHP" ];the
|
||||
_type_msg="suEXEC (using mod_fcgid)"
|
||||
_new_extension=suexec
|
||||
;;
|
||||
5) _type="STATIC"
|
||||
_type_msg="static site (No PHP engine enabled)"
|
||||
_new_extension=static
|
||||
;;
|
||||
*) echo ""
|
||||
echo -e "\t\033[1;33mFalsche Eingabe ! [ 1 = PHP-FPM ; 2 = mod_fcgid , 3 = mod_php ]\033[m"
|
||||
echo -e "\t\033[1;33mFalsche Eingabe ! [ 1 = PHP-FPM ; 2 = mod_fcgid , 3 = mod_php, 4 =suEXEC, 5 = static]\033[m"
|
||||
echo ""
|
||||
echononl "Your choice: "
|
||||
;;
|
||||
@ -440,6 +454,8 @@ else
|
||||
elif [ "$_type" = "MOD_PHP" ]; then
|
||||
_type_msg="mod_php (Apache PHP Module)"
|
||||
_new_extension=mod_php
|
||||
elif [ "$_type" = "STATIC" ]; then
|
||||
_new_extension=static
|
||||
fi
|
||||
|
||||
echo "Configure PHP implementation for \"$_type\""
|
||||
@ -1410,6 +1426,34 @@ else
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if $_https && [[ -z "$_https_only" ]]; then
|
||||
|
||||
echo ""
|
||||
echo -e "\033[1;32m--\033[m"
|
||||
echo ""
|
||||
echo -e "Only listen on SSL connections? Non SSL Connections will be redirected."
|
||||
echo ""
|
||||
echo ""
|
||||
OK=""
|
||||
echononl "Allow only SSL connections? [no]: "
|
||||
read OK
|
||||
OK=${OK,,}
|
||||
while [[ "X$OK" != "Xyes" && "X$OK" != "Xno" && "X$OK" != "X" ]]; do
|
||||
echononl "falsche Angabe! [no]: "
|
||||
read OK
|
||||
OK=${OK,,}
|
||||
done
|
||||
|
||||
if [[ "$OK" = "yes" ]] ; then
|
||||
_https_only=true
|
||||
else
|
||||
_https_only=false
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [ "$_type" = "FCGID" ]; then
|
||||
|
||||
echo ""
|
||||
@ -1532,13 +1576,10 @@ if [ "$_type" = "FCGID" ]; then
|
||||
fi
|
||||
|
||||
|
||||
if [ "$_type" != "MOD_PHP" ]; then
|
||||
#if [ "$_type" = "PHP-FPM" ]; then
|
||||
if [[ "$_type" = "PHP-FPM" ]] || [[ "$_type" = "FCGID" ]]; then
|
||||
|
||||
#if ! $_config_file_found ; then
|
||||
# clear
|
||||
#fi
|
||||
echo ""
|
||||
#echo -e "\033[21G\033[32mCreate vhost configuration \"${_DOMAIN}.${_TDL}.conf.$_new_extension\"\033[m"
|
||||
echo -e "\033[21G\033[32mCreate vhost configuration \033[m\"`basename $_new_vhost_config_file`\""
|
||||
echo ""
|
||||
if [ "$_type" = "FCGID" -a "$_COMMON_FCGI_CONFIG" = "true" ] ; then
|
||||
@ -1578,7 +1619,7 @@ if [ "$_type" != "MOD_PHP" ]; then
|
||||
fi
|
||||
|
||||
fi
|
||||
else
|
||||
elif [[ "$_type" = "MOD_PHP" ]]; then
|
||||
echo -e "\033[21G\033[32mUsing PHP Version from mod_php at Apache Installation"
|
||||
fi
|
||||
|
||||
@ -1674,7 +1715,6 @@ if [ "$_type" = "PHP-FPM" ]; then
|
||||
fi
|
||||
|
||||
|
||||
#clear
|
||||
if $_print_summary ; then
|
||||
echo ""
|
||||
echo ""
|
||||
@ -1725,6 +1765,7 @@ if $_print_summary ; then
|
||||
echo ""
|
||||
echo "Listen also for HTTPS connections.: $_https"
|
||||
if $_https ; then
|
||||
echo " Allow only SSL connections?....: $_https_only"
|
||||
echo " SSL Key File...................: $_ssl_key_file"
|
||||
echo " SSL Certificate File...........: $_ssl_cert_file"
|
||||
if [ -n "$_ssl_chain_file" ]; then
|
||||
@ -2446,7 +2487,14 @@ if $_suEXEC ; then
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$_type" = "FCGID" ]; then
|
||||
if $_https_only ; then
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
|
||||
EOF
|
||||
elif [ "$_type" = "FCGID" ]; then
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
|
||||
DocumentRoot $_doc_root
|
||||
@ -2650,7 +2698,14 @@ EOF
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$_type" = "FCGID" ]; then
|
||||
if $_https_only ; then
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
|
||||
EOF
|
||||
elif [ "$_type" = "FCGID" ]; then
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
|
||||
DocumentRoot $_doc_root
|
||||
@ -2693,15 +2748,15 @@ EOF
|
||||
Require all granted
|
||||
</Directory>
|
||||
EOF
|
||||
fi # if [ "$_type" = "FCGID" ]; then
|
||||
fi # if $_https_only ; then
|
||||
|
||||
if [ -n "$_custom_ipv6_log" ]; then
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
if [ -n "$_custom_ipv6_log" ]; then
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
|
||||
CustomLog $_custom_ipv6_log base_requests
|
||||
EOF
|
||||
fi
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
fi
|
||||
cat <<EOF >> ${_new_vhost_config_file}
|
||||
|
||||
CustomLog $_combined_custom_log combined
|
||||
ErrorLog $_error_log
|
||||
|
Loading…
Reference in New Issue
Block a user