How To Watch https Calls to Apache 2.4 using Perl and mod_status

Author: , September 5th, 2017

Step 1: Enable Apache status and lock it down: Make sure mod_status is being loaded: grep -Rn mod_status /etc/httpd/* 1 /etc/httpd/conf.modules.d/00-base.conf:58:LoadModule status_module modules/mod_status.so /etc/httpd/conf.modules.d/00-base.conf:58:LoadModule status_module modules/mod_status.so Add support for the call just under the first DocumentRoot statement: vim /etc/httpd/conf/httpd.conf 1 2 3 4 5 6 <Location /server-status>     SetHandler server-status     Require ip […]

How To Enable Compression On Apache Webservers

Author: , April 26th, 2016

Add the following to either .htaccess or httpd.conf: 1 2 3 4 5 6 7 8 9 AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE […]

How To Fix Peer Not Authenticated Errors While Using AWS API Tools

Author: , February 9th, 2016

I was getting the following errors when using an older version of the Amazon EC2 API Tools: $ ec2-describe-regions Unknown problem connecting to host: ‘https://ec2.amazonaws.com’ Unable to execute HTTP request: peer not authenticated The solution was to upgrade to the latest AWS CLI tools and start using the aws command instead. For example: aws ec2 […]

How To Allow Cross-Site Javascript Using Apache

Author: , September 24th, 2015

The key is to send a response header like this: Access-Control-Allow-Origin: * In the Apache web server, one enables this via the following directive: Header set Access-Control-Allow-Origin * This requires the use of mod_headers, which is enabled by default in Apache. For example: 1 2 3 4 5 6 7 8 9 LoadModule headers_module modules/mod_headers.so […]

How to Install Apache mod_evasive on AWS Linux/CentOS

Author: , July 26th, 2014

I was getting tired of using iptables to block the various hackers and bots constantly slamming my servers (the Chinese are the worst offenders by far – curse them!). I found the Apache module mod_evasive and installed it. Here are links to various articles about mod_evasive: http://www.zdziarski.com/blog/?page_id=442 https://coderwall.com/p/eouy3g http://www.crucialp.com/resources/tutorials/server-administration/flood-protection-dos-ddos-protection-apache-1.3-2.0-mod_dosevasive-avoiding-denial-of-service-attacks.php Add the Module to Apache I […]

How To Fix iOS 7.1 Error: Cannot install applications because the certificate is not valid

Author: , March 19th, 2014

After I upgraded to iOS 7.1, Enterprise application deployments no longer worked. I would get the following error: “Cannot install applications because the certificate is not valid”, and the download would fail. As it turns out, Apple changed the rules without notification again, and is now requiring https for part of the process. For those […]

How To Determine HTTP Protocol Using PHP

Author: , May 11th, 2012

$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== ‘off’) ? “https:” : “http:”;

How To Force Apache To Use https

Author: , October 26th, 2011

1 2 3 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

How To Determine The Current Protocol Using Javascript

Author: , February 18th, 2011

var myPrefix = ‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’;

Redirecting Using CGI.pm

Author: , October 7th, 2010

To generate a redirection header in CGI.pm use the following syntax where $q is the cgi handle: print $q->redirect(‘http://wyzaerd.com/documents/resume.pdf’); If you use redirection like this, you should not print out a header as well. You should always use full URLs (including the http: or ftp: part) in redirection requests. Relative URLs will NOT work correctly.