SyP-

vhostgenerator.sh

Mar 1st, 2021 (edited)
150
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. read -p "Ingrese nombre del sitio (ej. sitio.com): " SITE
  4.  
  5.  
  6. mkdir -p /var/www/$SITE
  7.  
  8. chown www-data:www-data /var/www/$SITE -R
  9.  
  10. echo "<VirtualHost *:80>
  11.    
  12.     ServerName $SITE
  13.  
  14.     ServerAdmin webmaster@localhost
  15.     DocumentRoot /var/www/$SITE
  16.  
  17.     ErrorLog \${APACHE_LOG_DIR}/$SITE.error.log
  18.     CustomLog \${APACHE_LOG_DIR}/$SITE.access.log combined
  19.  
  20. </VirtualHost>" > /etc/apache2/sites-available/$SITE.conf
  21.  
  22. a2ensite $SITE.conf
  23. service apache2 reload
  24.  
  25.  
RAW Paste Data