|
@@ -185,6 +185,18 @@ comprobarError() {
|
|
|
type="WARNING"
|
|
|
error="\n$type $codeNum:\tImposible encender cortafuegos.\n"
|
|
|
;;
|
|
|
+ 908)
|
|
|
+ error="\n$type $codeNum:\tError interno (instalar Virtual Host).\n"
|
|
|
+ ;;
|
|
|
+ 909)
|
|
|
+ error="\n$type $codeNum:\tVirtual Host '$extraInfo' no existe.\n"
|
|
|
+ ;;
|
|
|
+ 910)
|
|
|
+ error="\n$type $codeNum:\tImposible copiar Virtual Host '$extraInfo'.\n"
|
|
|
+ ;;
|
|
|
+ 911)
|
|
|
+ error="\n$type $codeNum:\tImposible activar Virtual Host '$extraInfo'.\n"
|
|
|
+ ;;
|
|
|
*)
|
|
|
error="ERROR 13:\tError interno (comprobación de errores)\n"
|
|
|
exitNum=1
|
|
@@ -512,6 +524,29 @@ configurarNginx() {
|
|
|
unset nginxConfFile
|
|
|
}
|
|
|
|
|
|
+instalarVirtualHost() {
|
|
|
+ # Configuramos un Virtual Host para Apache o Nginx
|
|
|
+ # Uso: instalarVirtualHost $webServerRoot $virtualHost
|
|
|
+ if [ $# -ne 2 ];then
|
|
|
+ comprobarError 1 908
|
|
|
+ fi
|
|
|
+ webServerRoot=$(realpath $webServerRoot)
|
|
|
+ virtualHost=$(realpath $virtualHost)
|
|
|
+ virtualHostName=$(basename $virtualHost)
|
|
|
+ if [ ! -f $virtualHost ];then
|
|
|
+ comprobarError 1 909 $virtualHostName
|
|
|
+ fi
|
|
|
+ cp -f $virtualHost "$webServerRoot/sites-available/$virtualHostName"
|
|
|
+ comprobarError $? 910
|
|
|
+ if [ ! -d "$webServerRoot/sites-enabled" ]; then
|
|
|
+ mkdir "$webServerRoot/sites-enabled" 2>/dev/null
|
|
|
+ comprobarError $? 5 "$webServerRoot/sites-enabled"
|
|
|
+ if
|
|
|
+ ln -s "$webServerRoot/sites-available/$virtualHostName" "$webServerRoot/sites-enabled/$virtualHostName"
|
|
|
+ comprobarError $? 911 $virtualHostName
|
|
|
+ unset webServerRoot virtualHost virtualHostName
|
|
|
+}
|
|
|
+
|
|
|
mostrarDatabase() {
|
|
|
if [ $debianOS = true ]; then
|
|
|
database=$(whiptail --title "BASE DE DATOS" --radiolist "<ESPACIO>: seleccionar <TAB>: cambiar <FLECHAS>: moverse\n\nEscoge la base de datos que quieres usar:" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) 2 \
|
|
@@ -724,6 +759,7 @@ establecerMaxUpload() {
|
|
|
}
|
|
|
|
|
|
instalarPHPInfo() {
|
|
|
+ # Instalar fichero php
|
|
|
infoFile="./var/www/info.php"
|
|
|
if [ ! -f $infoFile ];then
|
|
|
comprobarError 1 4 "$infoFile"
|
|
@@ -731,6 +767,25 @@ instalarPHPInfo() {
|
|
|
cp -f $infoFile /var/www/html/ 2>/dev/null
|
|
|
comprobarError $? 106
|
|
|
unset infoFile
|
|
|
+ # Instalar VirtualHost
|
|
|
+ if [ $apacheOn = true ];then
|
|
|
+ if [ $debianOS = true ];then
|
|
|
+ webServerRoot="/etc/apache2/"
|
|
|
+ virtualHost="./etc/apache-debian/sites-available/phpinfo.conf"
|
|
|
+ elif [ $rhelOS = true ];then
|
|
|
+ webServerRoot="/etc/httpd/"
|
|
|
+ virtualHost="./etc/apache-rhel/sites-available/phpinfo.conf"
|
|
|
+ fi
|
|
|
+ elif [ $nginxOn = true ];then
|
|
|
+ webServerRoot="/etc/nginx/"
|
|
|
+ if [ $debianOS = true ];then
|
|
|
+ virtualHost="./etc/nginx-debian/sites-available/phpinfo.conf"
|
|
|
+ elif [ $rhelOS = true ];then
|
|
|
+ virtualHost="./etc/nginx-rhel/sites-available/phpinfo.conf"
|
|
|
+ fi
|
|
|
+ fi
|
|
|
+ instalarVirtualHost $webServerRoot $virtualHost
|
|
|
+ unset webServerRoot virtualHost
|
|
|
}
|
|
|
|
|
|
habilitarServicio() {
|