Files
dtic-DIIAA/automatizacion/instalar_nginx_simple.sh
T

32 lines
860 B
Bash
Executable File

#!/bin/bash
# scripts/instalar_nginx_simple.sh
# Script para instalar Nginx y aplicar configuraciones (Sin manipulación de IP).
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}Ejecutar con sudo.${NC}"
exit 1
fi
echo -e "${YELLOW}[1/3] Instalando Nginx...${NC}"
apt-get update && apt-get install -y nginx
echo -e "${YELLOW}[2/3] Aplicando configuraciones de servicios...${NC}"
# Remover default si molesta
# rm /etc/nginx/sites-enabled/default 2>/dev/null
# Enlazar configs
CONFIG_DIR="/home/rmonla/Documentos/GitHub/dtic-DIIAA/servicios/nginx/conf.d"
ln -sf $CONFIG_DIR/*.conf /etc/nginx/conf.d/
echo -e "${YELLOW}[3/3] Iniciando servicio...${NC}"
systemctl enable nginx
systemctl restart nginx
echo -e "${GREEN}Instalación completada.${NC}"
echo "Nginx está corriendo en el Host."