0

I am trying to create a virtual host to just test a basic html website.

Guest OS - Ubuntu 14.04 Host OS - Ubuntu 14.10

In the Host OS, I connect through a proxy server which requires me to enter a user ID and password. I have a bridged network in the guest OS and I am able to connect to the internet in it.

So far I have done these steps.

1) Created the .conf file in /etc/apache2/sites-availableby doing this sudo cp 000-default.conf tasdikr-1081310234.conf

Then I edited it by sudo gedit tasdikr-1081310234.conf to something like this

<VirtualHost *:80>

#---------- Changes made -------------------

ServerName www.tasdikr-1081310234.com
ServerAdmin webmaster@tasdikr-1081310234.com
DocumentRoot /var/www/tasdikr-1081310234
ServerAlias tasdikr-1081310234.com

#---------- Changes made -------------------

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

2) Made the directory through this

sudo mkdir /var/www/tasdikr-1081310234
sudo chown $USER:www-data /var/www/tasdikr-1081310234
sudo chmod g+s /var/www/tasdikr-1081310234
sudo gedit /var/www/tasdikr-1081310234/index.html

Inside index.html I did something like this

<html>
  Welcome to tasdikr-1081310234.com!
</html>

3) After that I changes thehosts file in /etc/hosts

and after changing it looked something like this

127.0.0.1   localhost
127.0.1.1   tasdik

#---adding lines for my website---

127.0.0.2   www.tasdikr-1081310234.com  tasdikr-1081310234

#--------adding stuff done--------

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

4) After that I added my site by running

sudo a2ensite tasdikr-1081310234

And restarted apache

sudo service apache2 restart

It gave me a message like this

* Restarting web server apache2 
AH00558: apache2: Could not reliably determine the server's fully qualified
domain name,using         
127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                            [ OK ]

5) I entered the url http://tasdikr-1081310234.com and

http://tasdikr-1081310234 but I keep getting the error Error Code 11004: Host not found

PS : I also tried changing the modes. So I tried

  • sudo chmod -R 755 /var/www
  • sudo chmod -R 754 /var/www
  • sudo chmod -R 777 /var/www

But it is still giving me the same error.

Any help guys? I have been banging my head on this for the past 2 days.

I have also referred this Digital ocean - How to set up virtual hosts in ubuntu 14.10

Tasdik Rahman
  • 447
  • 3
  • 10
  • 21

1 Answers1

0

Your ServerName and ServerAlias do not match the URLs you tried to open: http://tasdikr-1081310234.com and http://tasdikr-1081310234. Try opening http://www.tasdikr-1081310234.com.

muru
  • 197,895
  • 55
  • 485
  • 740