LogLevel alert rewrite:trace6
Tag Archives: httpd
RewriteCond skip acme-challenge
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Invalid command ‘ProxyErrorOverride’, perhaps misspelled or defined by a module not included in the server configuration
a2enmod proxy
SSLCertificateFile: file ‘/etc/pki/tls/certs/localhost.crt’ does not exist or is empty
/usr/libexec/httpd-ssl-gencerts
centos 8 apache 2.4 real ip
LoadModule remoteip_module modules/mod_remoteip.so
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 192.168.0.0/16
ssl_error_rx_record_too_long
ERR_SSL_PROTOCOL_ERROR
NameVirtualHost have wrong IP address
apache find root
grep -i -r DocumentRoot /etc/apache2/sites-available/
grep -i -r DocumentRoot /etc/httpd/
deny from all apache 2.4
Require all denied
php enable hsts
<?php header("strict-transport-security: max-age=100");
Without https you will get NET::ERR_CERT_AUTHORITY_INVALID error:
You cannot visit website.com right now because the website uses HSTS. Network errors and attacks are usually temporary, so this page will probably work later.
strace httpd debug
strace -f $(for i in `ps aux | grep http | awk ' { print $2 }'`; do echo -n "-p $i "; done) $@ | tee /tmp/http_output
Sometimes helps to debug slow web
[access_compat:error] [pid 28167:tid 140515211155200] [client xx.xx.xx.xx:37918] AH01797: client denied by server configuration: /var/www/html/
Forbidden You don’t have permission to access / on this server
You should check directory permissions: namei -l /var/www/html/, if permissions are fine you need check virtual host configuration if there are no such options like ‘Deny from all’, if virtual host fine, you need search for .htaccess like this: find / -type f -name .htaccess
Primary script unknown error in php-fpm httpd rewrite
If you had something like this:
ProxyPassMatch “^/(.*\.php(/.*)?)$” “unix:/var/run/php-fpm/php.sock|fcgi://localhost/some/path” enablereuse=on
Advice is to change to SetHandler:
<Directory "/some/path"> <FilesMatch \.php$> ProxyErrorOverride on SetHandler "proxy:unix:/path/to/sock/php.sock|fcgi://localhost" </FilesMatch> </Directory>
pagespeed diredtacmin
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
rpm -i --nodeps mod-pagespeed-stable_current_x86_64.rpm
vi /etc/httpd/conf/extra/httpd-includes.conf
Include /etc/httpd/conf.d/pagespeed.conf
vi /etc/httpd/conf/httpd.conf
# Include conf/extra/httpd-deflate.conf
service httpd restart
apachectl -t -D DUMP_MODULES | grep speed
centos 7 apache itk
yum install httpd httpd-itk
htaccess suspend website
RewriteEngine On
RewriteBase
RewriteCond %{HTTP_COOKIE} !^.*secret-cookie.*$ [NC]
RewriteRule .* maintenance-page.html [NC,L,R=503]