Solved

Apache 1.3.29 vs IIS 5.1 (Virtual Host/Virtual Directory)

Posted on 2004-03-29
8
1,078 Views
Last Modified: 2012-05-05
In IIS, http://localhost/ refer to the files in the path C:\Inetpub\wwwroot
However it is simple to create a virtual host/directory. For example http://localhost/VirtualHostName/ refer to d:\MyWebsite\Website

In Apache, C:\Program Files\Apache Group\Apache\htdocs (same like IIS C:\Inetpub\wwwroot)
But how to create a virtual host and access locally like what IIS does? E.g. http://localhost/VirtualHostName/ refer to d:\MyWebsite\Website
0
Comment
Question by:ztot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 

Expert Comment

by:chulsey
ID: 10716882
The two technologies VirtualHost and Virtual Directory are quite different. IIS can do either or both of these. Apache on *nix can do this too, but it is not as easy. Just keep in mind that Virtual Hosting and a Virtual Directory are not interchangable terms and that there are some limitations when running Apache on Windows.

The Basics (Virtual Hosting)
There are three attributes required to define a web server, virtual or otherwise. These attributes are: IP Address, Listening Port, and ServerName (or HTTP1.1 header information). Every website, hosted on the same server, must have a unique combination of these attributes. No two websites hosted on the same server can have identical attributes to keep things working the way you would want.

I think you are actually asking how to do a Virtual Directory in Apache running on a Windows operating system. I don't know if this can be done using Apache on Windows. In *nix we can create a symbolic links, but I don't know how or if this can be done in Windows.

The closest solution I can think of is to change the default documents directory or "DocumentRoot" of your Apache installation. Look for a file named "httpd.conf". This file controls most of your Apache server configuration and is where you can define virtual hosts if you would like to do so. Using the information from your post, in this file you will see a declaration that looks something like this:

   DocumentRoot   C:\Program Files\Apache Group\Apache\htdocs

This line defines the default document directory for the default Apache web site.

OPTION #1 change the default document location
Modify the DocumentRoot line in httpd.conf to read as follows:

     DocumentRoot   d:\MyWebsite

Notice that I didn't include the trailing directory "Website" in this path. This is because you wanted the Apache installation to reference this site at "http://localhost/Website".

For additional information about virutal hosting with Apache check out
    http://httpd.apache.org/docs/vhosts/
        -- OR --
    http://httpd.apache.org/docs/
0
 

Author Comment

by:ztot
ID: 10722140
Thanks for ur comments, but this seem still can't solve my problem where i need it to refer to multiple folder. E.g. d:\MyWebsite\website and c:\Website2 and etc.

If the only way to make this is change the DocumentRoot then it will be very troublesome everytime b4 i view the files i need to chg the DocumentRoot. So any advance solution for this? Thanks.
0
 

Accepted Solution

by:
chulsey earned 50 total points
ID: 10723540
Sorry for the confusion, I don't think I interpreted your question the way you intended. The virtual directory equivalent directive in Apache is called "Alias".

So again in the httpd.conf file look for the section that defines a sample Alias directive. Using the example from your followup post the entry would look like:

Syntax of the Alias directive: Alias <virtual_dir> <physical_path>
So for this case the actual Alias line would read:

Alias /website D:\MyWebsite\website
Alias /website2 C:\website2

For more information about the Alias directive look at: http://httpd.apache.org/docs/mod/mod_alias.html#alias
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:ztot
ID: 10723964
it still not working after i add in the line
Alias /wow "D:\WOW Vision\WOW Vision.web\Website 1.10"
and try to access via http://localhost/wow/
it display "The page cannot be found"

Pls advise. Thanks.
0
 

Expert Comment

by:chulsey
ID: 10724653
Did you restart the Apache service after making a change to the configuration file?
0
 

Expert Comment

by:chulsey
ID: 10724798
This is from the link I posted earlier about the Alias directive.

"Note that if you include a trailing / on the url-path then the server will require a trailing / in order to expand the alias. That is, if you use Alias /icons/ /usr/local/apache/icons/ then the url /icons will not be aliased."

This would also mean the opposite is true as well. Try leaving off the trailing slash in the URL therefor accessing this site at http://localhost/wow instead of http://localhost/wow/
0
 

Author Comment

by:ztot
ID: 10733174
I found out the error is due to the directory drive. It is work fine in c drive.

Alias /wow "C:\WOW Vision\WOW Vision.web\Website 1.10"
Work Fine

Alias /wow "D:\WOW Vision\WOW Vision.web\Website 1.10"
The page cannot be found
(I'm very sure i have put the files in the D:\WOW Vision\WOW Vision.web\Website 1.10)

Other problem (Alias /wow "C:\WOW Vision\WOW Vision.web\Website 1.10") is when i access page via http://localhost/wow it shown "You are not authorized to view this page" However i can access it via full url http://localhost/wow/index.htm
How to make it access via http://localhost/wow instead of using full url? and how to make it as directory browsing?

Thanks.
0
 

Expert Comment

by:chulsey
ID: 10736281
It seems that maybe you have not read any of the links I included in earlier posts. Please take the time to read the Apache 1.3 documentation at http://httpd.apache.org/docs/. Almost all of the information you are asking about can be found there.

If you have a specific question, please feel free to post it as a new question, but please at least take the time to read the links someone provides to you. You will likely find more than just the answer to your question and might discover other configuration options you might want to use. Who knows you might even find an answer that will help someone else out some day.

The answer:
1) You need to create a <Directory> entry in your httpd.conf file
http://httpd.apache.org/docs/mod/core.html#directory
2) Set the Options directive for the Directory directive defined in step #1
http://httpd.apache.org/docs/mod/core.html#options
3) Set the Indexes option for the Options directive defined in step #2

The whole thing looks something like this:
    <Directory /wow>
    Options Indexes
    </Directory>
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

#Citrix #Citrix Netscaler #HTTP Compression #Load Balance
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question