In my last post of this series, I’ve shown you how to create a MySQL database using the GUI tools. In the fifth part of this tutorial, we’re now going to see how to add a virtual host.
A virtual host allows your web server to serve multiple websites from a unique shared IP address. Apache in this case, knows which website to serve based on the domain name requested by the web browser.
For this tutorial, we’re going to add a virtual host so that we can install phpMyAdmin to manage our MySQL database.
Usually we would install phpMyAdmin in a directory and configure an aliase so that it could be accessed from any website hosted on this web server (ie.: http://www.myfirstwebsite.com/phpmyadmin, http://www.mysecondwebsite.com/phpmyadmin, etc.).
But let’s not go there right now, we don’t want to get confused from the start.
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin info@thewebhostinghero.com
DocumentRoot /www/phpmyadmin
ServerName phpmyadmin
ErrorLog logs/phpmyadmin-error_log
CustomLog logs/phpmyadmin-access_log common
</VirtualHost>
127.0.0.1 phpmyadmin
The IP address 127.0.0.1 is a loopback address which means that it always point to your local computer.

The error message is caused by the fact that there’s simply no files in C:\www\phpmyadmin and that Apache has been configured to deny directory browsing. Once we have installed phpMyAdmin, we won’t see this error message again.
Stay tuned as next time we’ll install phpMyAdmin in our virtual host directory.
Click here to subscribe in a RSS reader or by email to receive updates.
Posted in Apache · MySQL · PHP · Tutorials · Windows Server | 5 Comments
| 1 | InMotion Hosting - $5.95 |
| 2 | WebHostingHub - $4.95 |
| 3 | iPage - $2.99 |
| 4 | JustHost - $3.45 |
| 5 | HostGator - $4.95 |
| 6 | FatCow - $3.67 |
| 7 | GreenGeeks - $4.95 |
| 8 | HostMonster - $5.95 |
| 9 | BlueHost - $6.95 |
| 10 | GoDaddy - $4.31 |
5 responses so far ↓
1. Response by : How To Install Your Own Web Server - Installing phpMyAdmin on Jun 12, 2008 at 1:28 pm
[...] Extract the content from the archive to your hard drive in C:wwwphpmyadmin (if you followed this tutorial). [...]
2. Response by : Hakan Atil on Dec 30, 2009 at 2:53 pm
Thank you for the tut. I helped me a lot.
3. Response by : sun on Jul 29, 2010 at 9:23 am
so that that your have explain everything about adding virtual host
now how can others view my web online all over the world?
in other word what can i do to enable people that does not belong to my network view the web address from there computer with internet
4. Response by : The Web Hosting Hero on Jul 29, 2010 at 9:34 am
@sun: depending if your web server is behind a router, you may have to configure port forwarding. Next you’ll have to use a dynamic dns service such as dyndns.org to have a domain name pointing to your ip address.
5. Response by : nash on Aug 4, 2010 at 7:37 am
i did all of this exactly and i get a 404 page not found error!
Here is what it says
Not Found
The requested URL / was not found on this server.
Apache/2.0.63 (Win32) PHP/5.2.9-1 Server at phpmyadmin Port 80
Please help
Leave a Comment