Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <VirtualHost *:80>
- ServerAdmin webmaster@localhost
- DocumentRoot /var/www/html
- ServerName ec2-54-234-167-188.compute-1.amazonaws.com
- ServerAlias www.ec2-54-234-167-188.compute-1.amazonaws.com
- ErrorLog /error.log
- CustomLog /access.log combined
- </VirtualHost>
- root@ec2-54-234-167-188:/home/ubuntu# cat deploy_site.sh
- #!/bin/bash
- # Definir el hostname
- # este servidor solo correr un sitio web
- # definir el hotname con el fqdn: misitio.com.ar
- read -p "Ingrese hostname: " host
- hostnamectl set-hostname $host
- read -p "Independicar directorio de datos para '$host'? y/n" crfs
- if [ $crfs == y ]; then
- # detenemos el servicio
- systemctl stop apache2
- # creamos el filesystem para xvdb
- mkfs.xfs /dev/xvdb
- # agregar entrada en el fstab
- echo "/dev/xvdb /var/www xfs defaults 0 2" >> /etc/fstab
- # montar el nuevo filesystem
- mount -a
- # recrear el document root
- mkdir -p /var/www/html
- # crear testigo
- echo "Testigo" > /var/www/html/index.html
- # Encender servicio apache2
- systemctl start apache2
- fi
- # Configurar vhost de apache
- echo "<VirtualHost *:80>
- ServerAdmin webmaster@localhost
- DocumentRoot /var/www/html
- ServerName $host
- ServerAlias www.$host
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- </VirtualHost>" > /etc/apache2/sites-available/000-default.conf
- # Cargar nuevas configuraciones
- systemctl reload apache2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement