Forum Moderators: phranque

Message Too Old, No Replies

Several websites but only one localhost. Can I split the localhost?

Several websites but only one localhost. Can I split the localhost?

         

richiebman

2:36 pm on Jan 8, 2005 (gmt 0)

10+ Year Member



I use apache on my pc to test my websites before I upload them. However now my websites are getting bigger and have more complex directory trees, what works offline doesn't work online and vice versa (link structure, calling scripts etc)

At the moment I have a folder called Server which is the localhost. This is therefore the root folder which then contains about 15 folders. Each folder contains a website. Online one of these folders would be the root, but offline my localhost folder is the root for all my websites.

So how do I configure apache to make each one of those 15 folders a root folder to itself? Or do I have to approach it from another direction?

Cheers,
R

jdMorgan

12:16 am on Jan 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest setting up named-based virtual servers (using fake domain names or real ones), and then using your computer's "Hosts" file to point the domain names to your localhost.

Jim

Nutter

2:00 pm on Jan 9, 2005 (gmt 0)

10+ Year Member



You can also use different ports on Apache. Personally, I used the 30,000 range, it seems fairly vacant of anything I'm likely to be using.

<VirtualHost *:300000>
ServerName yadayada.com
ServerAdmin bob@yadayada.com
DocumentRoot /home/web/yadayada
</VirtualHost>

Then, you just connect to [localhost:30000...] - it may not be the best way, but it works for me.

btw - I have port 80 mapped to a directory with an index.htm that has links to all the other sites so I don't have to remember which port is which.

- Ryan

richiebman

5:15 pm on Jan 9, 2005 (gmt 0)

10+ Year Member



Cheers guys. I went with the Hosts file method of redirection coz it took me ages to find port numbers that worked. Probably take me a day to find 15! Not sure why I couldn't find any - kept getting connection errors.

Everything is good.
Cheers again,
R