Pages

Wednesday 18 April 2012

Adding Apache document root permission to SELinux

On redhat linux with SELinux enabled, merely changing the document root path in the /etc/httpd/conf/httpd.conf file is not enough to make Apache work with the new location. Apache will give "File Not Found" error. To fix this problem, just use the following script. Make sure to change $HTTP_DOC to the location of the new apache document root.

#!/bin/sh

HTTP_DOC=/home/www/html

setsebool -P httpd_enable_homedirs on
chmod 755 $HTTP_DOC
chown -R apache.apache $HTTP_DOC
chcon -R -t httpd_sys_content_t $HTTP_DOC
 

2 comments:

  1. thank you kind sir. I only had information for the last part of the script and was under permission hell

    ReplyDelete
  2. The web hosting industry is known for its cut-throat competition over pricing, especially with cloud hosting becoming popular. But there are many web hosts who silently provide free services and advise to many organisations that deserve it. This article lists some of the ways in which many local web hosting providers help to get organizations and businesses online. https://onohosting.com/

    ReplyDelete