LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-20-2005, 10:52 PM   #1
elliottsb
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Rep: Reputation: 0
Unhappy Apache DocumentRoot problem


I just completed my first install of Apache 2 on Fedora Core 3. I tested the server after the install and it worked. Then, in the httpd.conf file I changed DocumentRoot and Directory to "/public_html/www" and restarted the server. It apparently didn't start because when I ran apachectl status I get "ERROR at dump.c:188: Connection refused." When I change DocumentRoot and Directory back to "/var/www/html" Apache works again.

Now, let me tell you about /public_html. It is /dev/sda1 (SATA drive) and has a single partition formatted as ext3 and mounted as /public_html. /public_html and /public_html/www both have 755 as permissions.

Is this anything that someone else has run across? I googled on this for a long while and came up with nothing. I didn't see anything in the logs either, but I might not be looking in the right place. I hope I'm not missing something simple here...
 
Old 02-21-2005, 02:39 AM   #2
linuxxed
Member
 
Registered: Feb 2004
Posts: 273

Rep: Reputation: 30
When you start apache - does it really start? Assuming you've started on 80 port then what does this command tell you

lsof -i:80


What do you see when you run the command

apachectl -k start

Can you display the contents of

ls /public_html/www
 
Old 02-21-2005, 09:16 AM   #3
elliottsb
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for your reply linuxxed.

If I leave DocumentRoot at /var/www/html (RPM install default) and start apache with apachectl -k start, lsof -i:80 yields the following:
Quote:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
httpd 11421 root 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11422 apache 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11423 apache 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11424 apache 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11425 apache 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11426 apache 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11427 apache 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11428 apache 3u IPv6 274175 TCP *:http (LISTEN)
httpd 11429 apache 3u IPv6 274175 TCP *:http (LISTEN)
When I change DocumentRoot to /public_html/www, apachectl -k start and lsof -i:80 display nothing.

As for the contents of /public_html/www, they are:
Quote:
drwxr-xr-x 2 root root 4096 Nov 11 10:38 cgi-bin
drwxr-xr-x 3 root root 4096 Feb 20 12:33 error
drwxr-xr-x 2 root root 4096 Nov 11 10:38 html
drwxr-xr-x 3 root root 4096 Feb 20 13:06 icons
-rw-r--r-- 1 root root 64 Feb 21 00:35 index.html
drwxr-xr-x 13 root root 4096 Feb 20 12:32 manual
drwxr-xr-x 2 webalizer root 4096 Feb 20 02:15 usage
I just copied this stuff from the default directory. I don't know if it is necessary.
 
Old 02-21-2005, 09:49 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,204
Blog Entries: 1

Rep: Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059
Take a look at your apache error.log to see why it doesn't start. I guess it has something to do with mod_userdir, and if so edit your apache config file (usually httpd.conf) to change the UserDir directory to the new location.
 
Old 02-21-2005, 10:56 AM   #5
elliottsb
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the suggestion bathory, but I'm not using user directories. I'm trying to modify where the documents are stored at the high level.

Now I've taken a different approach and came up with some interesting results. I left the global DocumentRoot and Directory alone. I added the following in the VirtualHost section:
Code:
<VirtualHost *:80>
  ServerName www.gunrdev.com
  ServerAlias gunrdev.com *.gunrdev.com
  DocumentRoot "/public_html/www"
  <Directory "/public_html/www">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>
  ErrorLog logs/www.gunrdev.com-error_log
  LogLevel debug
  CustomLog logs/www.gunrdev.com-access_log common
</VirtualHost>
Now apache will start, but I get the good old 403 error. However, like I've said before, the permissions for /public_html and /public_html/www are 755. The actual error message is as follows:
Quote:
Forbidden

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
 
Old 02-21-2005, 01:25 PM   #6
elliottsb
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Original Poster
Rep: Reputation: 0
I've tried several more things now. First of all, I realized that I can't use Vhosts since I want to use SSL. So I commented all of that section out.

Next I tried to get sneaky. I changed the DocumentRoot and Directory back to /var/www/html (default). Then I created /var/www/htmllink, which is a symbolic link to /public_html/www. Then I ran apachectl startssl and renamed /var/www/html.link to /var/www/html and renamed the actual folder /var/www/html to /var/www/html.old.

Well, it was sneaky, but it didn't work.

What it seems to boil down to is that I can't change DocumentRoot to a location on a physical drive other than the one where apache is installed.
 
Old 02-24-2005, 09:40 PM   #7
elliottsb
LQ Newbie
 
Registered: Feb 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Just in case anyone runs into this problem in the future...

I submitted this as bug 33679 and got a resolution. Turns out it was SELinux that was preventing the directory change. The resolution was to
Code:
chcon -R system_u:object_r:httpd_sys_content_t /my/new/docroot
or turn off the SELinux policy for httpd using:
Code:
setsebool -P httpd_disable_trans=1
 
  


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 won't display files in DocumentRoot PiGuy Linux - Newbie 6 01-21-2005 01:33 PM
how to change apache documentroot tr3s Red Hat 6 08-31-2003 10:34 AM
apache looking for documentroot in /usr/htdocs niehls Linux - Software 3 07-06-2003 05:39 PM
DocumentRoot apache illtbagu Linux - Software 6 02-28-2003 12:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:23 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