46 lines
1.0 KiB
Bash
46 lines
1.0 KiB
Bash
#!/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 -e "${bold}Instalación finalizada con éxito $normal \U2705 "
|
|
echo ""
|
|
echo "URL: http://$domain/"
|
|
else
|
|
echo -e "${bold} Error al instalar la configuración nginx $normal \U274C"
|
|
fi
|
|
}
|
|
|
|
main
|