Advertisement
fplanzer

apache2 virtualhosts

Jan 13th, 2020
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. mkdir -p /var/www/example.com/public_html
  2.  
  3. chown -R $USER:$USER /var/www/example.com/public_html
  4.  
  5. chmod -R 755 /var/www
  6.  
  7. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf
  8.  
  9.  
  10. /etc/apache2/sites-available/example.com.conf
  11. <VirtualHost *:80>
  12.     ServerAdmin admin@example.com
  13.     ServerName example.com
  14.     ServerAlias www.example.com
  15.     DocumentRoot /var/www/example.com/public_html
  16.     ErrorLog ${APACHE_LOG_DIR}/error.log
  17.     CustomLog ${APACHE_LOG_DIR}/access.log combined
  18. </VirtualHost>
  19.  
  20.  
  21. a2ensite example.com.conf
  22.  
  23. a2dissite 000-default.conf
  24.  
  25. systemctl restart apache2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement