Forum Moderators: phranque

Message Too Old, No Replies

Virtual Directories?

         

Spamn

12:49 am on Oct 9, 2004 (gmt 0)



I just switched over to Apache 1.3 from MS IIS 5.1. I was having way too many problems with IIS. I have used Apache before, but it was about two years ago and I don't remember how do to a lot of things.

I have my Apache dir on my D drive and I have some directories on my E drive that I would like hosted. How do I go about this? Not everything will fit on the same drive.

Thanks
Sam

encyclo

12:56 am on Oct 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com], Spamn.

What you need are Virtual Hosts: just right for this job. Virtual hosts allow one instance of Apache to host several sites, either as name-based or IP address-based hosts.

Here's the guide to virtual hosts on Apache 1.3:

[httpd.apache.org...]

If this a test/development machine (I assume it is), then go for name-based virtual hosting, add site names such as "site1.dev", site2.dev", etc. in your hosts file, then add the virtual hosts for each, with the document root pointing to the appropriate directory on the E: drive.

Spamn

1:05 am on Oct 9, 2004 (gmt 0)



I've read that and I don't quite follow. I just want to do this for example..

On my D drive is nothing but my Apache files. On my E drive I have a folder of pictures, a folder of music, etc. I want to use those pictures in my website. I'd also like the directory to be browseable. Other than putting the directories into my htdocs dir, I don't understand how to do it.

In ISS you just right clicked on a folder and made it a virtual dir. That was pretty convenient. I understand that Apache isn't going to be so OS related.

I know that I need to go into my httpd.conf and add in a virtual directory, but I just don't get what all to put. I tried adding one and the site wouldn't work all together. Where in the httpd.conf do I add it?

Sorry about all the questions. I guess it sounds like I want all the answers spoon fed to me. I've read the documentation and I'm reading over it again. I'm just so used to IIS, that it's hard to follow this.

Thanks

encyclo

1:15 am on Oct 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're hampered by the fact that, whilst Apache has a version which runs on Windows, it is a program primarily designed for Unix and Unix-type systems. On a Unix system, you can use symlinks to do what you want, but symlinks won't work in a Windows environment. You may be able to create functional symlinks by using a product such as Microsoft Services for Unix (a free download from microsoft.com), although I have no direct experience of that program, so I can't guarantee it.

Are you looking to use the same images/folders for several virtual sites, or are there specific, separate folders for each site?

Spamn

1:31 am on Oct 9, 2004 (gmt 0)



I have one site. I'm not looking to run two or even run a subdomain. I want to use some images on this site, but they aren't in my htdocs folder, or even on the same hdd.

I want to be able to use the images on my html pages and also have a link so that my images dir is browseable.

Spamn

1:34 am on Oct 9, 2004 (gmt 0)



My site is just a dumb little personal site. Nothing big. <snip> Maybe if you take a look at what I have going on, you'll better understand what I'm saying.

[edited by: jdMorgan at 1:55 am (utc) on Oct. 9, 2004]
[edit reason] Removed specifics per TOS [/edit]

encyclo

1:38 am on Oct 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you've only got one site, then you don't need virtual hosts - you just need to redefine the document root.

Open up you httpd.conf file in Notepad, and find the line beginning:

DocumentRoot

And change the path from

D:\Program Files\Apache\htdocs
(or whatever the path is now), to
E:\mysite
(or whatever folder you want on E:)

Then place the images in, for example,

E:\mysite\images
and restart Apache.

(Added: you might want to review the Terms of service [webmasterworld.com] for the forum, particularly about placing URLs to your sites).

Spamn

1:53 am on Oct 9, 2004 (gmt 0)



I apologize for the link. I read through the terms of service rather quickly the first time.

So I can't setup a virtual directory? I have to change the entire documentroot?

Looks like I need to move some stuff around on my HDDs.

Thanks for all of the advice.

uncle_bob

1:50 pm on Oct 9, 2004 (gmt 0)

10+ Year Member



Just use the alias directive, the apache web site has a whole page on this sort of stuff

[httpd.apache.org...]

Then you can spread your content wherever you want.

Spamn

9:09 pm on Oct 10, 2004 (gmt 0)



That worked perfectly! Thanks.