diff --git a/create_vhost.sh b/create_vhost.sh index 7156247..462ad5c 100755 --- a/create_vhost.sh +++ b/create_vhost.sh @@ -1335,10 +1335,8 @@ else ## - Get IPv6 Address ## - - if echo $line | grep -e "\s* /dev/null 2>&1 ; then - _ipv6=`echo $line | awk '{print$2}' | cut -d ']' -f 1 | cut -d '[' -f 2 ` + if echo $line | grep -E "\s* /dev/null 2>&1 ; then + _ipv6="$(echo $line | grep -E "\s*> ${_new_vhost_config_file} # --- $_alias + EOF if [ "$?" != "0" ]; then _failed=true fi done -cat <> ${_new_vhost_config_file} - +if [ "$_ipv6" != "disabled" ]; then + cat <> ${_new_vhost_config_file} + +EOF +else + cat <> ${_new_vhost_config_file} +EOF +fi +cat <> ${_new_vhost_config_file} ServerAdmin $server_admin @@ -2836,10 +2842,19 @@ if [ "$?" != "0" ]; then fi if $_https ; then + if [ "$_ipv6" != "disabled" ]; then + cat <> ${_new_vhost_config_file} - cat <> ${_new_vhost_config_file} + +EOF + else + cat <> ${_new_vhost_config_file} +EOF + fi + + cat <> ${_new_vhost_config_file} ServerAdmin $server_admin @@ -2942,219 +2957,6 @@ EOF fi -if [ "$_ipv6" != "disabled" ]; then - - cat <> ${_new_vhost_config_file} - - -# --- -# --- IPv6 -# --- - - - - ServerAdmin $server_admin - - ServerName $_server_name -EOF - if [ "$?" != "0" ]; then - _failed=true - fi - for _alias in "${_server_aliases_arr[@]}" ; do - cat <> ${_new_vhost_config_file} - ServerAlias $_alias -EOF - if [ "$?" != "0" ]; then - _failed=true - fi - done - - if $_suEXEC ; then - cat <> ${_new_vhost_config_file} - - SuexecUserGroup $suEXEC_user $suEXEC_group -EOF - fi - -if $_https_only ; then - cat <> ${_new_vhost_config_file} - - RewriteEngine on - RewriteCond %{HTTPS} !=on - RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] -EOF -elif [ "$_type" = "FCGID" ]; then - cat <> ${_new_vhost_config_file} - - DocumentRoot $_doc_root - - - Require all granted - AllowOverride All - FCGIWrapper $FCGI_Wrapper - - SetHandler fcgid-script - - Options +ExecCGI - -EOF - elif [ "$_type" = "PHP-FPM" ]; then - cat <> ${_new_vhost_config_file} - - #ProxyErrorOverride On - - - SetHandler $_set_handler_fpm - - - - DirectoryIndex index.php index.html index.htm - - - DocumentRoot $_doc_root - - Require all granted - AllowOverride All - -EOF - else - cat <> ${_new_vhost_config_file} - - DocumentRoot $_doc_root - - AllowOverride All - Require all granted - -EOF -fi # if $_https_only ; then - -if [ -n "$_custom_ipv6_log" ]; then - cat <> ${_new_vhost_config_file} - - CustomLog $_custom_ipv6_log base_requests -EOF -fi -cat <> ${_new_vhost_config_file} - - CustomLog $_combined_custom_log combined - ErrorLog $_error_log - - -EOF - - if [ "$?" != "0" ]; then - _failed=true - fi - - if $_https ; then - - cat <> ${_new_vhost_config_file} - - - - ServerAdmin $server_admin - - ServerName $_server_name -EOF - if [ "$?" != "0" ]; then - _failed=true - fi - for _alias in "${_server_aliases_arr[@]}" ; do - cat <> $_new_vhost_config_file - ServerAlias $_alias -EOF - if [ "$?" != "0" ]; then - _failed=true - fi - done - - if $_suEXEC ; then - cat <> ${_new_vhost_config_file} - - SuexecUserGroup $suEXEC_user $suEXEC_group -EOF - fi - - if [ "$_type" = "FCGID" ]; then - cat <> ${_new_vhost_config_file} - - DocumentRoot $_doc_root - - - Require all granted - AllowOverride All - FCGIWrapper $FCGI_Wrapper - - SetHandler fcgid-script - - Options +ExecCGI - -EOF - elif [ "$_type" = "PHP-FPM" ]; then - cat <> ${_new_vhost_config_file} - - #ProxyErrorOverride On - - - SetHandler $_set_handler_fpm - - - - DirectoryIndex index.php index.html index.htm - - - DocumentRoot $_doc_root - - Require all granted - AllowOverride All - -EOF - else - cat <> ${_new_vhost_config_file} - - DocumentRoot $_doc_root - - AllowOverride All - Require all granted - -EOF - fi # if [ "$_type" = "FCGID" ] - - cat <> ${_new_vhost_config_file} - - SSLEngine on - - SSLCertificateFile $_ssl_cert_file - SSLCertificateKeyFile $_ssl_key_file -EOF - if [ -n "$_ssl_chain_file" ]; then - cat <> ${_new_vhost_config_file} - SSLCertificateChainFile $_ssl_chain_file -EOF - fi - - if [ -n "$_custom_ipv6_log" ]; then - cat <> ${_new_vhost_config_file} - - CustomLog $_custom_ipv6_log base_requests -EOF - fi - cat <> ${_new_vhost_config_file} - - CustomLog $_combined_custom_log combined - ErrorLog $_error_log - - -EOF - - if [ "$?" != "0" ]; then - _failed=true - fi - - fi # if $_https ; then - -fi # if [ "$_ipv6" != "disabled" ]; then - if ! $_failed ; then echo_ok else