Skip to content

Instantly share code, notes, and snippets.

@mhasan3
Created October 13, 2017 08:55
Show Gist options
  • Save mhasan3/63bade2262e2b0859da5dcee4aff8e6e to your computer and use it in GitHub Desktop.
Save mhasan3/63bade2262e2b0859da5dcee4aff8e6e to your computer and use it in GitHub Desktop.
how to create virtual host in ubuntu
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite example.com.conf
sudo service apache2 restart
sudo nano /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment