In my pc (running on Ubuntu) , I have configured apache and php.
I wanted to create a subdomain 'mysite.localhost' on my localhost
I have a folder /var/www/mysite
Which I would like to access like http://mysite.localhost/
I followed the steps in http://thinkingnectar.com/2008/getting-ubuntu-to-work-creating-subdomain-in-localhost/
Basically did the following
Edited /etc/host and added the following line
127.0.0.1 mysite.localhost
Created a new configuration file in /etc/apache2/sites-available/mysite
using
gksudo gedit /etc/apache2/sites-available/mysite
<VirtualHost *:80>
DocumentRoot /var/www/mysite
ServerName mysite.localhost
<Directory /var/www/mysite>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Saved the file, and run the following:
sudo a2ensite mysite
Finally restarted the Apache Server.
sudo /etc/init.d/apache2 restart
But on browsing http://mysite.localhost/ I get this message
"
Network Error (dns_unresolved_hostname) .Your requested host "mysite.localhost" could not be resolved by DNS. "
Can anyone suggest what could be going wrong?
Best Answer
I have a couple of suggestions that might help, but these are just "shots in the dark" since I don't have access to a system right now that I can set up with a similar situation to yours for testing.
/etc/hosts
, then restart your browser. That should allow it to pick up changes to yourhosts
file.mysite
files from/var/www/mysite
, but in your Apache config file, you specify that the directory will be served fromDocumentRoot /home/username/mysite/
. One of the two needs to change; either your expectation that the files will come from/var/www/mysite
, or theDocumentRoot
must be set to/var/www/mysite
(and correspondingly, the<Document ...>
declaration must then change as well.)If neither of these work, then you should also try pinging the system to make sure it's responding correctly, as in the following: