Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 01-18-2005, 01:41 PM   #1
Registered: Oct 2004
Posts: 98

Rep: Reputation: 15
Lightbulb How To: Use Windows Partition for Default Apache 2 Web Site

NOTE: This document was made after a problem I had getting a windows partition to work in Apache. See this thread for my original post:

I hope that this will help some folks who may be dual-booting like I am and need to share files between two OSs.


Using Windows Directories for Default Apache 2 Web Site
by Tika Carr (aka Fuzzie Dice)

License and Preamble

This is in ASCII text format and released with the GPL license found at If anyone wants to convert this into a HOWTO in DocBook format and distribute it, feel free to do so, as long as you keep my name in the credits somehow, as the original author, please. Modifications are welcome, of course.


This document will show you how to get the Apache 2 server to use your Windows partition directories INSTEAD OF the default Apache 2 directory. This is ONLY if you meet the following conditions:

- You will NOT need anyone accessing your web server from
the internet (and have your firewall set that way).

- You are on a single-user machine (not on a network).

- You will be using Apache 2 and your windows sub-directory
only for developing web sites before you upload them to
your hosting provider.

This is NOT for intranet, internet, or other server use as these settings probably won't work and might confuse things in those cases. This document will help you set up 'localhost' (your local server) to point to a windows directory (and cgi-bin in that directory) and make it useable so that when you go to http://localhost/ or http://localhost/cgi-bin/ in your browser, you'll be pulling in pages from the windows partition and not Apache 2's /var/www directory.

This setup was done using the Mandrake 10.0 distribution and Webmin via Firefox web browser. I'll be covering the direct-edit (probably faster) way to set this up and the Webmin steps in case you'd rather do it that way.

This is good for those who dual-boot and use both Windows and Linux on the same computer and on the same hard drive. This gives you the best of both worlds, as you can then share data on one partition (which I will refer to as win_d, with win_c being the Windows OS partition).

What You Need

You'll need to have the Apache 2 server installed, plus all the associated files, Perl modules, etc. Usually this is done for you in Mandrake 10.0 so you don't have to do anything. However, Webmin is NOT installed by default so if you plan to use that method of configuration, you'll need to go into your package manager and find it, then install it yourself (most package managers let you do a search for packages). You'll also need to know your path to your html directory on your Windows partition. For this example, I'll be using /mnt/win_d/html as the directory where web files are stored. This equates to D:\html on the Windows side of things.

Be sure you also have at least an index.html file with some text in it in your /mnt/win_d/html directory. This way you know for sure when you have accessed this directory. Create also a cgi-bin directory and put another index.html file in that with slightly different wording so that you can tell the difference between it and the main directory. This you'll need so that when we test the server, we know it's working.

Setup Via Configuration Files (Faster Method)

If you'd like to do this quick and easy, just start a shell and at the shell prompt, type: su then after that type in your root password (nothing will be echoed to the console). Once logged in as root:

Step 1:

Type: cd /etc/httpd/2.0/conf

Now use your favorite text editor to edit the httpd.conf file. Be sure there is a line somewhere in the file that says:

Include conf/vhosts/Vhosts.conf

If there isn't one, add one and save the file.

Step 2:

At the shell prompt, type: cd vhosts

Use your favorite text editor to edit the Vhosts.conf file. Type in the following lines at the end of the file. Be very sure you got everything correct! Or better yet, cut and paste these lines into the text file. When done, save the file.

DocumentRoot /mnt/win_d/html
ServerName localhost
Options FollowSymLinks
DirectoryIndex index.html index.htm default.html default.htm
<Directory "/mnt/win_d/html">
allow from all
order allow,deny
Options FollowSymLinks
DirectoryIndex index.html index.htm
<Directory "/mnt/win_d/html/cgi-bin">
allow from all
order allow,deny
Options ExecCGI FollowSymLinks IncludesNOEXEC
AllowOverride AuthConfig FileInfo Indexes Options
DirectoryIndex index.html index.htm index.php index.cgi
AccessFileName htaccess.cfg
Alias /cgi-bin/ /mnt/win_d/html/cgi-bin/

Step 3:

At the shell prompt, type: /etc/init.d/httpd restart

Now point your browser to http://localhost/ and you should see your /mnt/win_d/html/index.html file. Next try http://localhost/cgi-bin/ and you should see your /mnt/win_d/html/cgi-gin/index.html file.

You should be all set up at this point.

Using Webmin For Setup

Step 1:

In your web browser, point to http://localhost:10000/ and then log into the server using 'root' for a username and your root password.

Step 2:

Click on Servers at the top, then click the Apache icon. At the bottom, find a box labeled 'Create New Virtual Server' and fill in as follows (leave all other items at default):

Specific address:
Add name virtual server (if needed): UNCHECK!
Listen on address (if needed): UNCHECK!
Document root: /mnt/win_d/html
Server name: localhost
Click the Create button.

Step 3:
Click on the new virtual server icon and select Document Options. Leave all at default except:

Document root: /mnt/win_d/html
All users accessible (be sure it's selected)
Per-directory options file: Select radio button by text box and type: htaccess.cfg
Directory Options: Select radio button by 'Selected below'. Leave all radio buttons at 'no' except: follow symbolic links: yes
Click the Save button.

**** NOTE: ****
We use 'htaccess.cfg' instead of .htaccess because Windows by nature does not allow use of dot-files. All files in Windows normally MUST have a filename and an extension. I've seen dot-files created under Windows but I don't recommend it, just in case.

Step 4:

Click the Directory Indexing Icon. In Directory Index Files add the following, one item per line.


You MAY want to add in the Files to Ignore box: htaccess.cfg
Click the Save button.

Step 5:

In the virtual server page, go to the box named 'Create Per-Directory, Files or Location Optons and be sure the Type is 'Directory'. Type in this path and click the 'Create' button: /mnt/win_d/html

Step 6:

Click on the new directory, then the Access Control icon. In Restrict Access, click on the radio button 'allow then deny'. Under it, in the Action, find "Allow" in the drop down box. Leave 'Condition' at "All Requests". Click Save button when done.

Step 7:

Click the Document Options icon and then be sure the radio button is on 'Selected below'. Leave all options at 'no' EXCEPT set 'follow symbolic links' to 'yes'. Click Save button when done.

Step 8:

Click the Directory Indexing icon and under Directory Index files, type in (one item per line):


You MAY want to add in the Files to ignore box: htaccess.cfg
Click the Save button.

Step 9: Setting Up cgi-bin

Go back to the main server page and click on the virtual host icon for localhost. Then click on the Aliases and Redirects icon. Add the following:

From box: /cgi-bin/
To box: /mnt/win_d/html/cgi-bin/

Note that there MUST be a slash / before AND after the directory names!

Step 10:

In the 'Create Per-directory, files or location options', set Type to 'Directory' and use /mnt/win_d/html/cgi-bin/ for the path. Click the Create button.

Step 11:

Click on the icon for the new cgi-bin directory entry then click on the Access Control Icon. Set Restrict Access to 'Allow then Deny' and then be sure under it reads 'allow all requests' (select 'allow' from drop down box, etc.) Click the Save button when done.

Step 12:

Click the Document Options Icon. Click the radio button next to 'Selected below'. Leave all options to 'no' except the following:
Execute CGI Programs
Follow symbolic links
Server-side includes

Select Options file override to 'Selected below' and UNCHECK 'Hostname access control'. Click the Save button when done.

Step 13:

Click the Directory Indexing Icon. In the Directory index file box, enter the following (one item per line):


You MAY want to add in the files to ignore box: htaccess.cfg
Click the Save button when done.

Step 14:

At the top of the page, you'll see some tabs. Click on the one marked 'Apply Changes'. Then click 'Stop Apache' and then 'Start Apache'. Be sure to allow the browser to fully reload and stop before you click on a tab.

Now point your browser to http://localhost/ and you should see your web server page on /mnt/win_d/html. Point your browser to http://localhost/cgi-bin/ and you should see your page stored on /mnt/win_d/html/cgi-bin


Now you should be able to share your web files between Windows and Linux. You don't have to use an FTP server to upload your files if using Mandrake 10.0 which automatically mounts win_d. You can just write the files directly to /mnt/win_d/html or whatever directory and then try it in your browser.

Contact Info: As of January 18, 2005 I can be reached at FuzzieDice6000 (Yahoo Mail or Hotmail) or via
For spam protection, please don't change the above line when editing this document. Thanks.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache started but web site don't work acercatealaluz Linux - Newbie 2 05-25-2005 10:59 AM
*@!Z Yarg!!!! Web site in Apache not showing - think it is Permissions! ServerStorm Linux - Software 4 03-17-2005 10:17 AM
Apache-HTML can't open dir on web site comprookie2000 Linux - Networking 4 03-07-2005 02:40 PM
DISCUSSION: Using Windows Directories for Default Apache 2 Web Site RavenLX LinuxAnswers Discussion 0 02-09-2005 12:59 PM
Apache Web site updating? munzza Linux - Newbie 1 05-17-2002 02:51 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration