first commit

This commit is contained in:
KJ
2024-09-07 18:37:19 -04:00
commit f3d2a76dc3
9 changed files with 292 additions and 0 deletions

45
bin/adddomain Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash
function main() {
bold=$(tput bold)
normal=$(tput sgr0)
phpsocket="/run/php/root8.2.sock"
echo -n "${bold}Ingresa el dominio nombre del subdominio: $normal"
read -r domain
echo -e "Creando configración para \"$domain\" \U2705"
mkdir "/var/www/$domain"
echo "server {
listen 80;
index index.html index.php;
server_name $domain;
root /var/www/$domain;
location ~ \\.php\$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:$phpsocket;
}
location / {
try_files \$uri \$uri/ /index.php?\$args;
}
}"> "/etc/nginx/sites-available/$domain"
ln -s "/etc/nginx/sites-available/$domain" "/etc/nginx/sites-enabled/"
if nginx -t && service nginx reload;
then
echo "${bold}Instalación finalizada con éxito $normal \U2705 "
echo ""
echo "URL: http://$domain/"
else
echo "${bold} Error al instalar la configuración nginx $normal \U274C"
fi
}
main