Setting up localhost webserver

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Setting up localhost webserver

Postby mmm » Sat May 28, 2005 7:19 pm

I am a virtual newbie to Linux, so please bare with me on this one, as I am trying out Linux Mandriva to hopefully one day dump Window$. Although, I have installed Mandrake before, I've never tried it for serious work...

Anyway, on my Windows setup I have installed Apache, PHP, and MySQL - all of which I use to test my website(s) offline, before I put them online. Everything works fine.

In Linux, Apache auto loads (from what I noticed from previous Mandrake install), and I have also installed PHP and MySQL (all at install time).

So far, so good. The problem is, all the data is on my FAT32 / Windows drives. I do not want to copy over the files to a Linux partition as then in Windows I will not have access to the files.

So, I would like to know if there is a way to have the Linux Apache have access the Windows partition files.

Note 1: All my FAT32 drives auto mount at startup of Linux.

Note 2: Editing Linux line ending files when in Windows is no problem, as I have an editor that will read / write both Windows and Linux format text files, line endings.

I noticed the httpd.conf setup file for Apache is CONSIDERABLY shorter in Linux than it is for the Windows machine, so that's doubly confusing on how to edit the file.

So I guess I would like to know if it's possible for Linux to access / use the Windows partitions for Apache, and how to write what / where in the Linux Apache config file httpd.conf

Thanks
mmm
 
Posts: 7
Joined: Sat May 28, 2005 6:50 pm

RE: Setting up localhost webserver

Postby nelz » Sat May 28, 2005 8:22 pm

You need to change the setting for DocumentRoot to point to your Windows directory containing the files. You also need to change the <Directory> setting for the old DocumentRoot directory to the new value.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8492
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

RE: Setting up localhost webserver

Postby Guest » Sun May 29, 2005 3:12 pm

not sure why you would want to do this... but you just point the httpd.conf to the windows mount. By default, apache points to /var/www/html, you can change it to /mnt/windows/my documents/my webs or whatever your mount point is. So basically, just alter the DocumentRoot line in you httpd.conf file,

Good luck.

Regards
Richard
Guest
 

Postby mmm » Mon May 30, 2005 6:11 pm

I tried amending the httpd.conf file (server stopped), and also the hosts file. but I don't get much joy. The server does work, as when you type to find 127.0.0.1, you get the message that the server is configured here welcome page.

The problem is, I get the same message for all the "virtual hosts" entries I tried, worse, that if I try to find say mydomain/index.html, it says it cannot be found. On my Windows setup, going to the virtualhost location gets you the directory tree of that URL.

However, I'll concentrate on the biggest problem, that DocumentRoot is not pointing to where I want it to, according to the error log for the server. This is what I've put into the httpd.conf file:

DocumentRoot "/mnt/win_c2/Web Page/Internet - working on"

The following error is produced when I try accessing the index.htm file that under the Windows / Apache setup exists.

[Mon May 30 18:22:17 2005] [error] [client 127.0.0.1] File does not exist: /var/www/html/index.html

Why is it pointing to /var/www/html/ instead of my Windows location?
mmm
 
Posts: 7
Joined: Sat May 28, 2005 6:50 pm

Postby nelz » Mon May 30, 2005 6:45 pm

That looks like an invalid setting, so maybe Apache is reverting to the default. It should be something like

DocumentRoot "/mnt/win_c2/Web Page"
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8492
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby mmm » Tue May 31, 2005 9:58 am

Unfortunately, your suggestion for the shortened DocumentRoot string didn't work.
mmm
 
Posts: 7
Joined: Sat May 28, 2005 6:50 pm

Postby nelz » Tue May 31, 2005 11:54 am

What does "didn't work" mean?

Did you set up a suitable <Directory> section too?
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8492
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby mmm » Wed Jun 01, 2005 9:16 pm

I forgot about adding / amending the <Directory> section, so I copied that from my Windows setup (which works).

Apologies for being vague, but in "not work" I mean the same error is still occuring, that 127.0.0.1 is showing itself as "/var/www/html/" etc. in the error log file. It does not seem to recognise the directory that I have told Apache2 to use (should work even if it is a Win directory).

And for others that are curious, I want to get it working on accessing the "Windows" files as for now Windows is very much my main OS, I am "playing" / learning more about Linux until such time that I can dump Win.

Here is a section that is concerned with the "root" of the server:

Code: Select all
DocumentRoot "/mnt/win_c2/Web Page/"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features. 
#
# This bit commented out by me, following uncommented section
# is taken from the Windows version of this file.
#<Directory />
#    Options FollowSymLinks
#    AllowOverride None
#</Directory>

<Directory />
    Options FollowSymLinks ExecCGI ALL
    AllowOverride All
#    AllowOverride None
    order allow,deny
    allow from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "/usr/local/apache2/htdocs">
<Directory "/mnt/win_c2/Web Page/">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
    Options Indexes FollowSymLinks All +ExecCGI
#    Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None

#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all

</Directory>
mmm
 
Posts: 7
Joined: Sat May 28, 2005 6:50 pm

More on http.conf

Postby mmm » Sun Jun 05, 2005 9:04 am

As a "flash" of boredom, I decided to do a search for the text pattern "www/html" for every file.

I came up with a few hits, but the most of interest was to a httpd.conf file located in:
/usr/share/ADVX/compat

I have heard that in Linux you can create "symbolic links" to files, I guess something similar concept to Windows shortcuts. Could this be a file that is symlinked somehow? And if so, how would I find out? This is the only file that I can think of that is preventing the DocumentRoot I want being read properly, as it is, that file contains:
DocumentRoot /var/www/html
... the exact thing that the error_log file has logged.

I don't want to change / rename / delete anything that could scr*w up the setup.
mmm
 
Posts: 7
Joined: Sat May 28, 2005 6:50 pm

Postby skecs » Sun Jun 12, 2005 5:44 am

Does the Apache server user, "www" or "www-run" or similar, have read & execute permissions to the directory mounted on "/mnt/win_c2/Web Page/" ? You can "ls -al /mnt/win_c2/Web Page/" which should display permissions.

Is the Windows directory mounted at boot or are you manually mounting the directory everytime you are checking the files?
Regards from
Downunder!
.... _
... (0)>
... / /\
.. / / .)
.. V_/_
Linux Powered!
User avatar
skecs
 
Posts: 76
Joined: Fri Apr 22, 2005 9:22 am
Location: Bathurst, NSW Australia


Return to Help!

Who is online

Users browsing this forum: towy71 and 1 guest