Category Archives: Apache

CentOS 7 – allowing port 80 & 443 httpd



firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent

and then…

firewall-cmd --reload


How to check the zones?

firewall-cmd --get-zones


If you can’t connect to the server/page…

or with curl…

hell:~ pjrfigueiredo$ curl
curl: (7) Failed to connect to port 443: Connection refused

Check if anything is listening to 443

sudo netstat -lnp | grep 443

If nothing show up… try to edit the domain httpd configuration file… and make it so, that httpd is listening to it… like for example

<VirtualHost *:80 *:443>




End of script output before headers – No such file or directory: exec of


[Wed Jul 19 16:08:45.679229 2017] [cgi:error] [pid 2954] [client] End of script output before headers:4KUYWRBjpMFod9i.cgi
[Wed Jul 19 16:09:05.030839 2017] [cgi:error] [pid 783] [client] AH01215: (2)No such file or directory: exec of ‘/home/webroot/’ failed

I saw a few blog posts and forum threads about this issue, but NONE was able to help me….

Yah!, syntax was okay….

perl -c 4KUYWRBjpMFod9i.cgi
4KUYWRBjpMFod9i.cgi syntax OK

I’v created a brand new file on /cgi-bin/ with some dummy filename and pumped a simple perl script on it…

# -- my first perl script!
print "Content-type: text/html\n\n";
print "Hello, world!\n";

I was able to run it successfully, so…. the issue wasn’t on the CGI/PERL/APACHE/FIREWALL/SUEXEC.
I guess that the 4KUYWRBjpMFod9i.cgi had some issue… even using file -i  it looked to be okay… I’v decided to copy the content of 4KUYWRBjpMFod9i.cgi to the new dummy cgi file … and it worked….

I guess that the issue was on the encoding of the original cgi…

pagespeed – Slow ReadFile operation on file

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


Some disk stats….

sudo hdparm -Tt /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/
    LoadModule proxy_balancer_module modules/
    LoadModule proxy_http_module modules/
    # Uncomment these to proxy FTP or HTTPS
    #LoadModule proxy_ftp_module modules/
    #LoadModule proxy_connect_module modules/


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.