Solved

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

Posted on 2004-03-29
8
1,067 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
  • 5
  • 3
8 Comments
 

Expert Comment

by:chulsey
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:ztot
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Expert Comment

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

Expert Comment

by:chulsey
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
Resolve DNS query failed errors for Exchange
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now