first commit
This commit is contained in:
45
bin/adddomain
Normal file
45
bin/adddomain
Normal 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
|
Reference in New Issue
Block a user