httpd serving wrong DocumentRoot

Mark Weaver mdw1982 at mdw1982.com
Wed Mar 16 20:26:38 UTC 2005


Duncan Lithgow wrote:
> On Wed, 2005-03-16 at 14:13 -0500, Mark Weaver wrote:
> 
>>Duncan Lithgow wrote:
>>
>>>Okay, thanks all for your suggestions. I think the problem here is that
>>>I'm used to windows where I can basically stick anything just about
>>>anywhere and it works fine. I understand why that is silly, but it's
>>>what i got used to... so lets start from scratch.
>>>
>>>a.) where is the *most logical place* for me to put the files i want to
>>>serve and work on?
>>>b.) what will i need to change from the default configurations? ( apart
>>>from commenting out /etc/httpd/conf.d/welcome.conf )
>>>
>>>I'd just really love to make this work soon - it's really holding up
>>>some projects... I nearly went back and got started in windows again!
>>>
>>>Duncan
>>>
>>
>>Hi Duncan,
>>
>>The apache "out-of-the-box" settings will work just fine. Place your 
>>files to be served in /var/www/html and away you go.
>>
>>if you are going to place your web files inside a directory that is a 
>>sub-dir of /var/www/html like /var/www/html/duncan_projects, then you 
>>will need to create a Directory container so apache knows where they are 
>>and knows exactly how it should serve those files:
>>
>>	<Directory "/var/www/html/duncan_projects">
>>	  AllowOverride All
>>	  Options ExecCGI # if you're going to use (.pl/.cgi - cgi-bin)
>>	</Directory>
> 
> Yup, i've started to learn what that's for now
> 
>>thats about all there is to it for a default apache installation.
> 
> 
> Thanks, but by default I can't write to "var/www/html" surely I
> shouldn't edit everything as root!?
> 
> What permissions should I put on that directory? Is this how it's
> usually done for developing websites? I just got my head around having
> a /home folder and now I seem to be putting my stuff all around - is
> there a conceptual error oging on in my expectations?
> 
> Thanks for the help Mark
> 
> Duncan
> 

well, on my web server "I" have ownership of everything, including the 
directories, /var/www/html, /var/www/cgi-bin. The only ownership 
exception are the other folders that apache or root "should" own and 
those folders that belong to people that I'm hosting a site for.

ownership on my web server looks something like this:
ls -l /var/www
total 56
drwxr-xr-x   6 mdw1982   apache 4096 Mar  1 09:31 cgi-bin
drwxr-xr-x   3 root      root   4096 Jan 17 16:16 error
drwxr-xr-x  45 mdw1982   apache 4096 Mar 14 19:57 html
drwxr-xr-x   3 root      root   4096 Jan 17 17:45 icons
drwx------   2 root      root   4096 Jan 17 07:48 lost+found
drwxr-xr-x  13 root      root   4096 Jan 17 16:15 manual
drwxr-xr-x   2 webalizer root   4096 Mar  1 04:03 usage

ls -l /var/www/html
total 18336
-rw-rw-r--   1 mdw1982      apache      939 Sep 13  2003 ab_site.css
drwxr-xr-x  10 mdw1982      apache     4096 Dec 31 20:49 accounts
drwxr-xr-x   2 mdw1982      apache     4096 Dec 31 19:04 addon-modules
-rw-rw-r--   1 mdw1982      apache     4795 Mar 16  2003 ani_logo.gif
drwxr-xr-x   5 mdw1982      apache     4096 Dec 31 20:49 bbinsch
drwxr-xr-x   4 mdw1982      apache     4096 Dec 31 20:49 changelog
drwxr-xr-x   2 mdw1982      apache     4096 Dec 31 20:49 css
drwxr-xr-x   7 backmountain apache     4096 Mar  2 16:16 
dallas-backmountainhomes.com
drwxr-xr-x   7 mdw1982      apache     4096 Feb 18 18:11 
deepdrawnenclosures.com
drwxr-xr-x   8 mdw1982      apache    77824 Mar 14 11:02 destinyimage
-rwxrw-r--   1 mdw1982      apache     2303 Jan  1  2004 direc_create.html
-rwxr--r--   1 mdw1982      apache     2663 Jan  1  2004 direc_help.html
-rwxr--r--   1 mdw1982      apache       66 Jan  1  2004 dir_list.php
-rw-r--r--   1 root         root   17902039 Feb 16 15:30 di_store_web.tgz
drwxr-xr-x  11 mdw1982      apache     4096 Feb  2 19:33 docs
-rw-rw-r--   1 mdw1982      apache      409 Sep 13  2003 
enter_calculater.php
drwxr-xr-x   5 mdw1982      apache     4096 Dec 31 20:49 EZTrack
drwxr-xr-x  10 mdw1982      apache     4096 Dec 31 20:50 fishBoneTech
-rw-r--r--   1 mdw1982      apache      445 Oct 28 18:41 form_test.html
drwxr-xr-x   4 mdw1982      apache     4096 Dec 31 20:50 genesis
-rw-rw-r--   1 mdw1982      apache     3602 Oct 12  2001 hierArrays.js
-rw-rw-r--   1 mdw1982      apache    23806 Oct 12  2001 hierMenus.js
-rw-r--r--   1 mdw1982      apache     6726 Nov 12  2003 hitTrack.pl
drwxr-xr-x   3 mdw1982      apache     4096 Dec 31 20:50 HM
-rwxr--r--   1 mdw1982      apache       37 Jan  5  2004 htaccess_temp
drwxr-xr-x   4 interch      apache     4096 Jan 28 10:15 ic_demo
drwxr-xr-x  16 mdw1982      apache     4096 Dec 31 20:50 images
-rw-r--r--   1 mdw1982      apache     5575 Mar 13  2002 index.shtml
-rw-r--r--   1 mdw1982      apache     5575 Mar 13  2002 index.shtml.rpmnew
drwxr-xr-x  13 interch      apache     4096 Jan 28 10:15 interchange-5
drwxr-xr-x   3 mdw1982      apache     4096 Dec 31 20:50 java
drwxr-xr-x   2 mdw1982      apache     4096 Dec 31 20:50 javascript
-rw-rw-r--   1 mdw1982      apache      438 Nov  1  2003 
javascript_test.html
-rwxr--r--   1 mdw1982      apache     1138 Aug 28  2004 js_form_test.html
drwxr-xr-x   2 mdw1982      apache     4096 Dec 31 20:50 jsProgress
-rwxr--r--   1 mdw1982      apache     2270 Nov  3  2003 js_testing.html
drwxr-xr-x  10 mdw1982      apache     4096 Mar  4 07:40 LCCBB
drwxr-xr-x   6 mdw1982      apache     4096 Dec 31 20:50 lccenter
-rwxr--r--   1 mdw1982      apache      822 Dec  6  2003 link1.html
-rw-rw-r--   1 mdw1982      apache      298 Dec  6  2003 link1.php
-rwxr--r--   1 mdw1982      apache      597 Nov  3  2003 link2.html
-rwxr--r--   1 mdw1982      apache      487 Nov  3  2003 links2.html
-rwxr--r--   1 mdw1982      apache      996 Nov  3  2003 linksNanchors.html
drwxr-xr-x  10 mdw1982      apache     4096 Dec 31 20:50 mandrakeot
-rw-r--r--   1 mdw1982      apache     4612 Nov 19  2003 menu.html
-rw-rw-r--   1 mdw1982      apache      440 Dec  6  2003 mysql_test.php
-rwxr--r--   1 mdw1982      apache      389 Jan  4  2003 new_index.shtml
-rwxr-xr-x   1 mdw1982      apache      451 Nov 23  2002 newone.php
-rw-rw-r--   1 mdw1982      apache      828 Aug 21  2003 new_phpTest.php
-rwxr--r--   1 mdw1982      apache     1596 Sep  3  2003 Noname1.html
-rw-r--r--   1 mdw1982      apache      427 Mar 13  2002 optim.html
drwxr-xr-x   7 mdw1982      apache     4096 Jan  5 12:03 phpMyAdmin
-rw-rw-r--   1 mdw1982      apache     2234 Sep 13  2003 php_test1.php
-rw-rw-r--   1 mdw1982      apache     1311 Sep 13  2003 php_test.php
-rw-r--r--   1 mdw1982      apache      557 Mar 13  2002 platform.html
drwxr-xr-x  17 mdw1982      apache     4096 Dec 31 20:50 pphlogger
drwxr-xr-x   6 mdw1982      apache     4096 Dec 31 20:50 pricesheet
drwxr-xr-x   3 interch      apache     4096 Mar  1 09:31 rliardon
-rwxr--r--   1 mdw1982      apache      316 Feb  2 13:11 robots.txt
drwxr-xr-x   2 mdw1982      apache     4096 Dec 31 20:49 screens
drwxr-xr-x   3 mdw1982      apache     4096 Mar 15 10:22 search_fedoraCore
-rwxrw-r--   1 mdw1982      apache      687 Jun 18  2003 simpleMailTest.html
drwxr-xr-x   9 mdw1982      apache     4096 Dec 31 20:50 simpletrack
drwxrwxr-x   8 rich	    apache     4096 Mar 12 19:48 soundaudiosystems.info
drwxrwxr-x   7 rich         apache     4096 Mar 16 07:26 
soundaudiosystems.net
drwxr-xr-x  10 mdw1982      apache     4096 Dec 31 20:50 squirrelmail
drwxr-xr-x   3 interch      apache     4096 Feb  2 14:24 store_destinyimage
drwxr-xr-x   2 mdw1982      apache     4096 Dec 31 20:50 TIJ3rd
-rwxr--r--   1 mdw1982      apache     3932 Mar 12  2003 timerbar.js
drwxr-xr-x   5 mdw1982      apache     4096 Dec 31 20:50 timesheet
-rwxr--r--   1 mdw1982      apache      509 Apr 20  2004 tracker_test.html
-rwxr--r--   1 mdw1982      apache      488 Apr 20  2004 tracker_test.php
-rwxr--r--   1 mdw1982      apache      170 Aug 17  2003 ultramode.txt
-rwxr--r--   1 mdw1982      apache      550 Oct  1  2003 Untitled2.html
-rwxrwxrwx   1 mdw1982      apache     1323 Nov 13  2003 updater.css
-rwxr--r--   1 mdw1982      apache     1584 Sep 28  2003 updater.css.bak
-rw-r--r--   1 mdw1982      apache    21999 Nov  8 11:25 vinyl_barrier.html
drwxr-xr-x   3 mdw1982      apache     4096 Dec 31 20:50 virus
drwxr-xr-x   7 mdw1982      apache     4096 Dec 31 20:50 visitor_stats
drwxr-xr-x   8 mdw1982      apache     4096 Mar  7 21:31 wsm

and of course "root" owns /var/www which is set chmod 755

This way I am free to edit anything on the web server without having to 
ftp to the server as the user owning that directory in order to develop 
or update a site.

-- 
Mark
-----------------------------------------------------------
Paid for by Penguins against modern appliances(R)
Linux User Since 1996
Powered by Mandrake Linux 8.2, 10.0 & RH Fedora Core 3




More information about the fedora-list mailing list