LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-02-2009, 12:23 PM   #1
CmdoColin
Member
 
Registered: Jul 2009
Posts: 31

Rep: Reputation: 17
Understanding Apache Permission


Trying to understand apache permissions - and I'm not understanding it the httpd.conf

I have my default DocumentRoot set as:

Code:
DocumentRoot "/var/www/html"
Now if I want another path, do I add an additional Document root? Under the manual it says:

"The directory out of which you will serve your documents. By default, all requests are taken from this directory, but symbolic links and aliases may be used to point to other locations."

Or should another directory be specified elsewhere? UserDir:? DirectoryIndex:?
 
Old 09-02-2009, 12:40 PM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
It depends on what you want to achieve. Why do you want to add another path?

With the given path, http://localhost serves pages that are stored there. Need a subdirectory, create it in /var/www/html/ (like /var/www/html/subdir) and access it using http://localhost/subdir

Want to serve some pages from your homedirectory? Create a symlink in /var/www/html pointing to somewhere in your homedirectory.

Want to serve the whole site from your homedirectory? Change the current documentroot to the directory from where you want to serve.

You might get some permission issues (403 forbidden) but that can be solved.


PS The last one is what I use in a multisite setup (virtual hosting)

Last edited by Wim Sturkenboom; 09-02-2009 at 12:41 PM.
 
Old 09-02-2009, 06:35 PM   #3
chandramani_yadav
Member
 
Registered: Jan 2007
Location: Vienna
Distribution: Redhat
Posts: 47

Rep: Reputation: 19
/var/www/html is the default document root define in the httpd.conf however when you configure a virtual Apache server then you can use any directory as document root provided Apache has R/Rw access to that directory and sub directory.

all that you have to add it

DocumentRoot /srv/blah/blah....
then define the scope for that directory.

in case if want to use a different document root for main Apache server also then comment the original one and add your preferred document root and define the scope for it as it was defined for the /var/www/html.
 
Old 09-03-2009, 11:45 AM   #4
CmdoColin
Member
 
Registered: Jul 2009
Posts: 31

Original Poster
Rep: Reputation: 17
Appreciate the help here - just struggling to get my head around this. I've got stuff working on an operational system by just following the documentation to the letter - but that is nothing more than data entry. I'm trying to understand what I'm doing. I'm either finding guides which make me bleed from the ears, or it's someone telling me what a webserver is. If there's a good guide out there that's going to help someone who is a Linux user get his head around the Linux admin side of this - more than happy to read that =)

I've got an old PC I can try things with - as I do find I learn things better by breaking them, and then fixing them.

Having another play around with this. I'm probably being thick - but I'm getting a 403 error when trying to connect:

ls -l /var/www/html
total 24
lrwxrwxrwx 1 Fred Fred 11 2009-09-03 17:18 Fred -> /home/Fred/
-rwxr-xr-x 1 root root 19108 2009-08-04 12:17 index.html
drwxr-xr-x 2 root root 4096 2009-09-03 17:15 mymrtg

mymrtg is working fine, and so is index.html

I guess that you've got to have decent permissions - so tried doing some gentle chmod, gave up and hit it with 777.

[root@Utred Fred]# ls -l index*
-rwxrwxrwx 1 root root 71 2009-09-03 17:17 index.html

Under my logs I'm seeing:

[Thu Sep 03 17:26:12 2009] [error] [client 192.168.1.104] (13)Permission denied: access to /Fred/index.php denied
[Thu Sep 03 17:26:12 2009] [error] [client 192.168.1.104] (13)Permission denied: access to /Fred/index.html denied
[Thu Sep 03 17:26:12 2009] [error] [client 192.168.1.104] (13)Permission denied: access to /Fred/index.html.var denied

So I'm still being denied - what am I doing wrong?
 
Old 09-03-2009, 12:19 PM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
As far as I know, this is not a file system permission error.

Code:
    <Directory "/home/Fred">
        Order allow,deny
        Allow from all
    </Directory>
You can add this just after the applicable DocumentRoot.

PS Which distro are you using? This is important to know as different distros (can) use different ways to configure apache.

Last edited by Wim Sturkenboom; 09-03-2009 at 12:21 PM.
 
Old 09-04-2009, 12:42 PM   #6
canyonbreeze
LQ Newbie
 
Registered: Apr 2009
Posts: 18

Rep: Reputation: Disabled
Check your owner and group as well. Maybe chown Fred:Fred index.html? Some setups don't like to see owner root (depending on configuration).
 
Old 09-07-2009, 06:04 AM   #7
CmdoColin
Member
 
Registered: Jul 2009
Posts: 31

Original Poster
Rep: Reputation: 17
Cheers Guys,

It was a file under /etc/httpd/conf.d/****.conf that was stopping me from viewing the pages. Changed that as detailed above by Wim Sturkenboom, and it all started working. Well, the username and password bit isn't, but I'm under the illuision I'll be able to fix that if I properly set the users up. Going to try that as soon as I get the chance.

The system I'm playing around on is fedora 10. The server I've been working on is a Ubuntu server. The fedora box I can do what I want with and break it as much as I like. The server is production, so I can't. It just kinda scares me when I follow some instructions and don't understand what I've done. One day someone will call you and ask you to fix it...

Much appreciated, it's given me some confidence with it, and more importantly a way into actually understanding the admin documentation and what the various parts of that config are doing. Thank you =)
 
Old 09-08-2009, 02:17 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You could try this, it's pretty good: http://www.linuxtopia.org/online_boo..._ch-httpd.html

Also http://www.linuxhomenetworking.com/w...che_Web_Server

Last edited by chrism01; 09-08-2009 at 02:18 AM.
 
  


Reply



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
Understanding UseCanonicalName in Apache h725 Linux - Server 3 09-27-2008 02:54 AM
Apache not understanding service requests on FC8 prabhatsoni Linux - Software 11 11-21-2007 06:08 AM
Permission denied in apache packets Linux - Newbie 2 05-20-2007 06:15 PM
No permission using Apache sanmartin Linux - Networking 2 09-22-2004 12:48 PM
Understanding Servers and Apache squi Linux - Newbie 1 09-19-2003 01:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:29 AM.

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