My Task :
The domain www.mynewsite.lk
is configured and hosted in a hosting server with the IP address 192.168.1.100
. Another domain called www.mysite.lk
should also be configured with the same content without any duplication. Here I want to configure the Apache server with name-based virtual hosting.
First of all I Created directory which contains the file of my site and add 'home.html' file.
sudo mkdir /var/www/website
sudo vim /var/www/website/home.html
After I created new virtual host file as default.conf
in /etc/apache2/sites-available
folder and it is look like
<VirtualHost 192.168.1.100>
ServerAdmin webmast@new.lk
DocumentRoot /var/www/website
DirectoryIndex home.html
ServerName www.mynewsite.lk
Serveralias www.mysite.lk
ErrorLog /var/log/error/website/error.log
CustomLog combined
</VirtualHost>
Next I created directories to hold 'Error.log'
sudo mkdir /var/log/error
sudo mkdir /var/log/error/website
Then I set the DNS using sudo vim /etc/hosts
and I added following line that file
192.168.1.100 www.mysite.lk www.mynewsite.lk
After I enabled the default.conf
file that I created using sudo a2ensite default.conf
command
Then I run the this command
sudo ifconfig vmnet0: 192.168.1.100 netmask 255.255.255.0 up
And last I reloaded the apache server using sudo /etc/init.d/apache2 reload
command
I had an error as Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
what do I do to make this error...? Please help me to complete my task.
Is there an any error I created .conf <VirtualHost>
...?
apache2
, it might be configuration error. I had also the same issue. Remove & reinstall apache2 didn't solve my problem but when i reinstalllibapache2-mod-mono
, i got to know that i mis configured one file & it was simple grammatical error. – d a i s y Jul 08 '16 at 03:58See 'systemctl status apache2.service' and 'journalctl -xn' for details.
Did you try it? – d a i s y Jul 08 '16 at 04:02