Re: Apache can't use directory not in root partition?



Roger N. Clark (change username to rnclark) wrote:
Hi,
I just brought up red hat workstation 4 and I am trying to
get the apache server running.

I have 3 partitions:

/
/home
/a

The default httpd.conf file has DocumentRoot "/var/www/html"
which works fine, and I can change it to something like
/usr/local/html, but if i change it to /home/smith/html
or /a/www/html apache fails on startup giving an error
at the DocumentRoot line number saying DocumentRoot must
be a directory.  I've checked multiple times and it is a
valid directory and is readable (uid=root gid=root rwxr-xr-x)
with same permissions as /var/www/html.

I've also tried setting up virtual hosts, and while I do not
get start-up errors, I can't see the contents of the
directories on /home or /a, but can see the contents just fine
with directories in the root partition.

Any ideas?  Or does apache 2.0 need to serve documents in the
root partition only?  I've been running web servers on linux
and/or unix for about a decade and have never had this problem.

Thanks for any help/ideas
Roger Clark

I have a partial solution:

The problem is an SELinux issue and is described on this web site:

http://www.siliconvalleyccie.com/linux-hn/apachebasic.htm

"SELinux security context labels can be modified using the chcon command.
Recognizing the error, user root uses chcon with the -R (recursive) and -h
(modify symbolic links) qualifiers to modify the label of the directory to
httpd_sys_content_t with the -t qualifier."

  chcon -R -h -t httpd_sys_content_t /var/www/html

So when I do this, everything works in /var/www/html
So then I change DocumentRoot to /a/www/html and run the chcon
command, but I still can't get it to work there.

Roger
.



Relevant Pages

  • Apache cant use directory not in root partition?
    ... get the apache server running. ... or /a/www/html apache fails on startup giving an error at the DocumentRoot line number saying DocumentRoot must be a directory. ... with directories in the root partition. ...
    (comp.os.linux)
  • Re: [Full-disclosure] Bug with .php extension?
    ... the behavior that is i.e. demonstrated on default installations of Apache, only that this time not mod_negotiation, but mod_mime is responsible. ... Unknown extensions contribute nothing, and since they're unknown, it isn't known which category they aren't known for, so nothing happens with them. ... - Disable PHP for the upload area (is this possible? ... you would want your user upload area to be in a totally different place from your DocumentRoot so you don't get anything set on DocumentRoot leaking into the writable subdirectory. ...
    (Full-Disclosure)
  • Re: Why wont this script run??
    ... I reinstalled apache, and it works. ... > DirectoryIndex index.html index.htm.var index.htm ... DocumentRoot /home/www/html ... ServerName mo.moso.dk ...
    (Fedora)
  • Re: loaded latest edition of Apache http server on XP, and installed php on that server...
    ... You need to specify the document root (the directory that Apache will ... look for files when asked to serve them) in your "httpd" configuration ... Once you set up your "DocumentRoot", place the files you want to run in ... my browser, but then an error message came up, shutting down apache. ...
    (comp.lang.php)
  • Re: loaded latest edition of Apache http server on XP, and installed php on that server...
    ... You need to specify the document root (the directory that Apache will ... look for files when asked to serve them) in your "httpd" configuration ... Once you set up your "DocumentRoot", place the files you want to run in ... my browser, but then an error message came up, shutting down apache. ...
    (comp.lang.php)