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-available
by 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
</VirtualHost>
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
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
If your domain “tasdikr-1081310234.com” is not registered with a registrar and pointed to your server’s public IP address you will not be able to reach it by name regardless of what you configure on the server itself. If this is just for testing you can add a hosts file entry on your local computer pointing your name to your server’s IP. This will allow this computer to browse to the domain and test your configuration.
On Windows the hosts file is in:
On Linux and OS X it is located in: