Forum Moderators: phranque

Message Too Old, No Replies

VirtualHost, DNS, DocumentRoot.

I need your help...

         

joepr

3:44 pm on Sep 21, 2006 (gmt 0)

10+ Year Member



Hello nobody! I'm an italian student (sorry if I make language mistakes). I registered here because I need much help, that italian Apache forums didn't give me.

I'm going to say you what I need practically.

I've got a PC (2GHz, 384MB RAM) with Windows, Apache 2.2.2, PHP 4.4.2 and MySQL 5.0.22.

I've used it so far to do three different things, but always in DIFFERENT MOMENTS:
- to run PHP/MySQL not-public utilities, therefore stopping extern access with the Windows firewall on the port 80 (utilities like PhpMyAdmin, PHP calendars and other #*$!in' stuffs);
- to test PHP/MySQL websites (I'm a webmaster), therefore stopping extern access with the Windows firewall and launching websites in the browser using "localhost/";
- to have an external access (example, from my school PCs) on my server, so I can download file from my home-PC, therefore permitting access on port 80 and registering a dynamic DNS.

In this moment I'd like to do this three things at the same time with the same PC, separating files for the three different functions in different folders.
Practically (I'm going to simplify paths) I'd like to have:
- C:\PHPUtility as the DocumentRoot of a host NOT external accessible, perhaps launching it with "localhost/utility";
- C:\WebDev as the DocumentRoot of a host NOT external accessible, launching it with "localhost/";
- C:\WebPublic as the DocumentRoot of a host external accessible with a dynamic DNS, like "joep.freedomain.org/". It's not necessary that I can view the public host from my own PC, where it runs.

Maybe it's not difficult, maybe impossible, bat PLEASE, HELP ME!

mack

1:28 pm on Sep 23, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hi joepr, welcome to WebmasterWorld :)

This is indeed possible, you need to make sure your computer is connected to a static IP address. You also need to make sure your router can be configured to forward all port 80 traffic to your server (computer).

Apache allows you to have multiple www root folders I suppose we could call these virtual folders.

When you type in [localhost...] the server will display the contents of the apache public_html folder. What you can do is create a new folder, for example c:\folder then create what is known as a virtual host to mount this as an apache folder.

There are 2 ways of doing this. name based virtual hosting and IP based virtual hosting. Virtual hosting is a term used to describe a technique used to host multiple sites on the same ip address or server.

If you have a domain name that you wish to use for setting up your publicly available section then you should look into using name based virtual hosting. If not then name based virtual hosting is the method you should use.

Name based virtual hosting works by sending the user to the correct part of the server depending on the domain name they used to visit the server. This is very commonly used by web hosting companies who will have hundreds of not thousands of accounts per server.

name based virtual hosting [httpd.apache.org]

IP based virtual hosting [httpd.apache.org]

Hope this points you in the right direction.

Mack.

joepr

2:04 pm on Sep 23, 2006 (gmt 0)

10+ Year Member



Thank you, I'll try it as soon as possible and I'll tell you... :D