1
votes

I am working Linux Mint 17.3 and trying to create virtual hosts on Apache 2.4. I have followed the following procedure, but still can't browse the site:

  1. Create two new virtual hosts
    sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/site1.com.conf

  2. modify each host
    sudo vim /etc/apache2/sites-available/site1.com.conf
    ServerName site1.com
    ServerAlias www.site1.com
    ServerAdmin [email protected]
    DocumentRoot /var/www/site1.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

3.Enable the New Virtual Host Files
sudo a2ensite site1.com

// Disable original html host
sudo a2dissite 000-default.conf

sudo service apache2 reload

  1. Add host info
    sudo vim /etc/hosts
    127.0.0.1:88 site1.com
    127.0.0.1:89 site2.com

I have checked out everything online, that I could. Today is my second day. Thanks in advance for your help.

1

1 Answers

0
votes

In your second step, you should declare that host as a VirtualHost in the conf file:

<VirtualHost *:80>
   ServerName site1.com 
   ServerAlias www.site1.com 
   ServerAdmin [email protected]
   DocumentRoot /var/www/site1.com/public_html
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>