Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:?
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.
/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.
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.
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 =)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.