Category Archives: Apache

pagespeed – Slow ReadFile operation on file

[Sat May 27 07:17:27.539747 2017] [pagespeed:error] [pid 19961] [mod_pagespeed 1.11.33.5-0 @19961] Slow ReadFile operation on file /var/cache/mod_pagespeed/rname/ic_QOs6thfRpiBUn09lB5Du/http,3A/,2Fdomain.com/assets/slideshow/slide_02.jpg,40x,40._,: 59.944ms; configure SlowFileLatencyUs to change threshold\n

 

Some disk stats….

sudo hdparm -Tt /dev/root

/dev/root:
 Timing cached reads: 26330 MB in 2.00 seconds = 13178.47 MB/sec
 Timing buffered disk reads: 540 MB in 3.00 seconds = 179.73 MB/sec

I’v added the following lines to my pagespeed configuration file (/etc/apache2/mods-enabled/pagespeed.conf)

ModPagespeedSlowFileLatencyUs 100

 

CentOS – Enable the mod_proxy modules in the HTTPD

In our /etc/httpd/conf/httpd.conf lets see if we have the following lines on it.
Uncomment them or add them.

  1. LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    # Uncomment these to proxy FTP or HTTPS
    #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
    #LoadModule proxy_connect_module modules/mod_proxy_connect.so
    

 

apache – proxy & proxy_http

 

Invalid command ‘ProxyPreserveHost’, perhaps misspelled or defined by a module not included in the server configuration

sudo a2enmod proxy

 

[Sun Feb 26 03:48:38.613627 2017] [proxy:warn] [pid 9117] [client 94.63.XXX.XXX:49486] AH01144: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

sudo a2enmod proxy_http

Restart apache and everything should be okay now.
HOORAY!

.htaccess: Invalid command ‘ExpiresActive’ and .htaccess: Invalid command ‘Header’

 

.htaccess: Invalid command ‘ExpiresActive’, perhaps misspelled or defined by a module not included in the server configuration,
ln -s /etc/apache2/mods-available/expires.load /etc/apache2/mods-enabled/
.htaccess: Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration
a2enmod headers

At the end… restart Apache!

service apache2 restart

How to get a Let’s Encrypt certificate while using CloudFlare

 

How to get a Let’s Encrypt certificate while using CloudFlare

./certbot-auto certonly --webroot --webroot-path /usr/share/nginx/html/ --renew-by-default --email [email protected] --text --agree-tos -d example.tld -d www.example.tld

Cloudflare – ban country with .htaccess

One of my clients asked me to BAN an specific country to one of his sites.
Since we have Cloudflare, this is how I made it…

On .htaccess I’v simply added the following lines – on the top of .htaccess -.

SetEnvIf CF-IPCountry IN BuzzOff=1
SetEnvIf CF-IPCountry PT BuzzOff=1
Order allow,deny
Allow from all
Deny from env=BuzzOff

But remember!
Domain/subdomain must have Cloudflare active on DNS settings…