How To Set Up Apache Virtual Hosts and host a website without any cpanel or other software

Command 1 :
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/

Command 2 :
sudo nano /etc/apache2/sites-available/

Replace with this Content :
<VirtualHost *:80>
    DocumentRoot /home/ubuntu/public_html/magento
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


Enable the New Virtual Host Files
sudo a2ensite

After this, if the site comes then it’s okay, if not then you need to change a little.
on nano /etc/apache2/apache2.conf
<Directory ‘your setup directory’>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
In my Case my ‘your setup directory’ is /home/ubuntu/public_html/magento
Ref :

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.