User Tools

Site Tools


linux:useful_apache

This is an old revision of the document!


Useful Apache

Force SSL

cat <<'END_OF_TEXT' >> /etc/httpd/conf/httpd.conf
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
END_OF_TEXT
service httpd restart

=Disable HTTP Trace=

cat <<'END_OF_TEXT' >> /etc/httpd/conf/httpd.conf
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
END_OF_TEXT
service httpd restart

Enable Log Rotation

To enable log rotation on CentOS 6, run the following

cat <<'END_OF_TEXT' >> /etc/logrotate.d/httpd
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    daily
    rotate 7
    postrotate
        /sbin/service httpd reload > /var/log/httpd/rotate 2>&1 || true
    endscript
    compress
}
END_OF_TEXT
linux/useful_apache.1590395146.txt.gz · Last modified: (external edit)