Reputation: 1460
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:
Create two new virtual hosts
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/site1.com.confmodify 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.confsudo service apache2 reload
- 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.
Upvotes: 1
Views: 569
Reputation: 78
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>
Upvotes: 0