LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 08-31-2003, 07:00 AM   #1
tr3s
Member
 
Registered: Aug 2003
Location: Philippines
Posts: 35

Rep: Reputation: 15
how to change apache documentroot


hi all!

just a newbie to linux. i installed rh9 and just set up apache. it's working since the success page is displayed when i access http://localhost.

i changed the documentroot directive in the httpd.conf to /home/user1 and put a index.html there but i still got the success page when i access http://localhost.. i had a working set up of apache 2.0.x.x in winxp and got no problems there.

note: i manually modified it thru gedit since i cannot find a way to change it with gnome GUI config. httpd is already reloaded

any idea here pls... any help is appreciated

Last edited by tr3s; 08-31-2003 at 07:19 AM.
 
Old 08-31-2003, 07:21 AM   #2
r00tnuke
Member
 
Registered: Aug 2003
Location: /earth/usa/texas/houston
Distribution: Fedora C2
Posts: 64

Rep: Reputation: 15
use pico in terminal to check at the end if your httpd.conf file for your default root

# pico /etc/httpd/conf/httpd.conf

if it's not there (it should be) find the conf file by...

# slocate httpd.conf
 
Old 08-31-2003, 07:40 AM   #3
tr3s
Member
 
Registered: Aug 2003
Location: Philippines
Posts: 35

Original Poster
Rep: Reputation: 15
thanks r00tnuke...

yah, the file i'm editing is the /etc/httpd/conf/httpd.conf. the directives here are changed everytime i configure apache thru gnome GUI, meaning it is the correct file

i did what u said. i run slocate httpd.conf here is the result:

/etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf.bak
/etc/httpd/conf/httpd.conf~
/usr/share/apacheconf/httpd.conf.xsl
/usr/share/apacheconf/httpd.conf.md5

pico by the way is not in my commands list.

i really am new to linux, so pls understand
 
Old 08-31-2003, 08:47 AM   #4
r00tnuke
Member
 
Registered: Aug 2003
Location: /earth/usa/texas/houston
Distribution: Fedora C2
Posts: 64

Rep: Reputation: 15
Even though the httpd.conf file seems a little over whelming, you will appreciate more whats going on with apache and can probably use it more quickly by editing it directly.

I think the GUI's strip all the comments out too so that sux when your trying to learn.

If you don't have pico then use joe as an editor.

The best thing you can ever do is make a copy of httpd.conf as httpd.sav befor you ever edit it

#cp httpd.conf httpd.sav

That way you can screw-up all you want and still get back to the original

#cp httpd.sav httpd.conf

:-)
 
Old 08-31-2003, 09:10 AM   #5
tr3s
Member
 
Registered: Aug 2003
Location: Philippines
Posts: 35

Original Poster
Rep: Reputation: 15
ok. ahhemm... got a copy of my orig file.

i'm a bit familiar with httpd.conf directives thru my apache installation on my winXP. editing the DocumentRoot and Aliases directives in the .conf file allows me to specify the files or folder to be served by the apache.

but i'm having problem here in linux. is it a user privilege problem or something? by the way, what i want to do is set my document root to /home/user1. how will i do that?

here are some lines:

ServerRoot "/etc/httpd"
User apache
Group apache
ServerAdmin user1@mail.com
ServerName user1
DocumentRoot /home/user1
Listen *:80

Last edited by tr3s; 08-31-2003 at 09:50 AM.
 
Old 08-31-2003, 10:17 AM   #6
r00tnuke
Member
 
Registered: Aug 2003
Location: /earth/usa/texas/houston
Distribution: Fedora C2
Posts: 64

Rep: Reputation: 15
Here is what I suggest. Compare the properties of your directory with the properties of the original default apache DocumentRoot. Make sure your properties are the same.

I also suggest a less painfull editor for most all of your servers called Webmin. Download it from http://www.webmin.com

You will find it to be quit a usefull tool in which you can make changes in a graphical interface that does not destroy your conf file in the process by removing important descriptions and comments. As usual always make a .conf file backup.

Just download the rpm. and install. it is html based but does not require apache to run on your station.

http://localhost:10000

By-the-way, I looked at my httpd file and right off I could not see from what you gave me any problem other than the first suggestion.
 
Old 08-31-2003, 10:34 AM   #7
tr3s
Member
 
Registered: Aug 2003
Location: Philippines
Posts: 35

Original Poster
Rep: Reputation: 15
me too, i really don't know why it is so. of course, even just a read permission on /home/user1 should allow apache to display at least an index.html.

oh, it's not pointing to /home/user1 actually. it is still pointing to /var/www/html, i assume

kinda weird huh

thanks anyway, pal!
 
  


Reply


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
Changing Apache DocumentRoot walterbyrd Linux - Software 1 10-18-2005 03:30 PM
Apache DocumentRoot problem elliottsb Linux - Software 6 02-24-2005 09:40 PM
Apache won't display files in DocumentRoot PiGuy Linux - Newbie 6 01-21-2005 01:33 PM
Apache httpd DocumentRoot question orange400 Linux - General 7 05-24-2004 03:41 AM
DocumentRoot apache illtbagu Linux - Software 6 02-28-2003 12:04 AM


All times are GMT -5. The time now is 08:12 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration