Archive for the tag 'Apache'

SBDavid

Disable SELinux for Apache

Disable SELinux for Apache

You can disable Apache SELinux protection easily.
Please keep in mind that by disabling SELinux for apache you are inviting more security related problems.

Disable Apache SELinux Protection

Open /etc/selinux/targeted/booleans file using a text editor:

# vi /etc/selinux/targeted/booleans

Append or modify value for httpd_disable_trans as follows:

httpd_disable_trans=1

Save and close the file. Type the following two commands:

# setsebool httpd_disable_trans 1
# /etc/init.d/httpd restart

GUI tool to disable SELinux for Apache

Open a shell prompt type the command system-config-securitylevel

system-config-securitylevel

Next select SELinux tab > click on Disable SELinux protection for httpd daemon checkbox > Save the changes

Finally restart httpd service:

# /etc/init.d/httpd restart

Showing files in a directory Using Apache.

If you want to list all files in a directory that doesn’t use an index.html (or index.php) file, you can create an .htaccess file with the following contents

Options +Indexes

This will tell apache that you want to list all files in the directory.

Apache won’t start nothing in the logs

Chance are, if apache isn’t starting and isn’t logging anything, the error_log is full preventing apache from starting. To double check that, run:

cd /var/log/httpd
ls -lS | less

If any file is around 2-3 gig (or more), then chances are, that’s the problem.

The solution is to remove the logs, restart apache, and then implement preventative measures.

Get logrota to rotate daily.

# see “man logrotate” for details
# rotate log files daily
daily

# keep 2 weeks worth of backlogs
rotate 2

« Prev