Author:
erics, April 11th, 2023
PROBLEM: I was seeing the following error when trying to do a plugin update, and an error in my WordPress logs: Update failed: 504 Gateway Timeout Gateway Timeout The gateway did not receive a timely response from the upstream server or application. [Tue Apr 11 22:12:01.373709 2023] [proxy_fcgi:error] [pid 26878] (70007)The timeout specified has expired: […]
Categories: How-To's, Technology Tags: 00-proxy_timeout.conf, 504, 504 ERROR, 504 Gateway Timeout, apache, fcgid.conf, Gateway Timeout, Gateway Timeout (504), Gateway Timeout Error, howto, HTTP 504, HTTP Error 504 – Gateway Timeout, Performance, php-fpm, Restart, Speed, systemctl, Timeout, tips, tuning
|
No comments
Author:
erics, November 17th, 2017
|
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} |
Categories: How-To's, Technology Tags: apache, Apache 2.2, Apache2, howto, http, https, mod_rewrite, redirect, tips
|
No comments
Author:
erics, September 5th, 2017
Step 1: Enable Apache status and lock it down: Make sure mod_status is being loaded:
|
shell> grep -Rn mod_status /etc/httpd/* /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:
|
shell> vim /etc/httpd/conf/httpd.conf <Location /server-status> SetHandler server-status Require ip 127.0.0.1 Require ip ::1 Require ip {Your_IP_Here} </Location> |
Step 2. Prepare your environment:
|
shell> cpan YAML HTML::TableExtract |
Step 3: Create and run the status script: (See the astat contents at the bottom)
|
shell> vim /root/astat shell> chmod 755 /root/astat shell> vi ~/.bashrc ADD: alias ipw='while true; do sleep 5; /root/astat; done' shell> ipw 1.2.3.4|yourdomain.com:443|POST /wp-cron.php?doing_wp_cron=1563901063.57946491241455078125| |
/root/astat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/usr/bin/perl use strict; use HTML::TableExtract; # PATH to "curl" utility my $CURL = "/usr/bin/curl"; # URL of the server-status we want to process my $STATUS_URL = "http://localhost/server-status"; # those are the headers in the first row of the table we want to extract # Used by HTML::TableExtract to search for our table, within the whole HTML output my $headers =['Srv','PID','Acc','M','CPU','SS','Req','Conn','Child','Slot','Client','VHost','Request']; # Let's fetch the status page... my $output = `$CURL -s $STATUS_URL`; # Let's search for our table within the HTML... my $tables = HTML::TableExtract->new( headers => $headers ); # We found it (hopefully), so let's parse it... $tables->parse($output); # ...and let's stick to the first one my $status_table = $tables->first_table_found; # Now let's loop allover the rows... foreach my $row_ref ($status_table->rows) { # Let's de-reference the ARRAY reference, so to better manager # the various elements... my @row = @$row_ref; # Let's check for IP next if $row[10]=~/127.0.0.1/; next if $row[10]=~/216.66.125.161/; next if $row[10]=~/69.162.124.235/; # Let's check for an OPTIONS row... if ($row[12]=~/OPTIONS/) { # simply skip to next row in the loop next; } # Let's choose whatever columns we want (first column has index "0") # So here we have Srv, PID, Client and Request #foreach my $column (0,1,10,12) { foreach my $column (10,11,12) { print $row[$column]."|"; } print "\n"; } |
Categories: How-To's, Technology Tags: 2.4, apache, Apache 2.4, CPAN, howto, http, httpd, https, mod_status, perl, Status, tips, YAML
|
No comments
Author:
erics, August 21st, 2017
This post does not cover configuring letsencrypt or ssl/https. First, make sure your LetsEncrypt configuration points to the actual WordPress document root directory cat /etc/letsencrypt/renewal/www.yourdomain.com.conf
|
... [[webroot_map]] yourdomain.com = /volumes/data/www/yourdomain.com/prod/wordpress www.yourdomain.com = /volumes/data/www/yourdomain.com/prod/wordpress |
Second, use the new macro language feature in Apache 2.4 to configure an https redirect macro which does NOT redirect to https for anything in the .well-known subdirectory. This […]
Categories: How-To's, Technology Tags: 2.4, Acme, apache, Apache 2.4, Encrypt, https, LetsEncrypt, redirect, Renew, well-known, WordPress
|
No comments
Author:
erics, September 22nd, 2016
echo “umask 002” >> /etc/sysconfig/httpd service httpd restart
Categories: How-To's, Technology Tags: apache, howto, tips, umask
|
No comments
Author:
erics, August 25th, 2016
Apache 2.4 changed the security configuration directives a bit. Here is an example using basic auth:
|
<Directory "/path/to/your/wordpress"> AllowOverride All Options +FollowSymLinks +ExecCGI -Indexes Order allow,deny Allow from all <RequireAll> AuthType Basic AuthName "Protected Resource" AuthUserFile /path/to/your/.htpasswd Require valid-user </RequireAll> </Directory> |
What tripped me up for a while was that I still had the Require all granted directive inside the container, and that needed to be removed for the auth to work.
Categories: How-To's, Technology Tags: 2.4, apache, Apache 2.4, Auth, Authentication, Basic, howto, htpasswd, mod_auth, Protect, require, security, tips
|
No comments
Author:
erics, July 4th, 2016
If you get this error when starting Apache or via apachectl configtest: [warn] _default_ VirtualHost overlap on port 443, the first has precedence then you must add: NameVirtualHost *:443 to /etc/httpd/conf/httpd.conf, then restart Apache
Categories: How-To's, Technology Tags: 443, apache, AWS, CentOS, howto, https, Linux, Overlap, ssl, tips, VirtualHost, Web
|
No comments
Author:
erics, June 9th, 2016
If you need to use wget to obtain the contents of a web page, but that page has either Basic or Digest Authentication enabled, use the following syntax to gain access: wget –http-user=yourUserNameHere –http-password=yourSecretPasswordHere http://example.org/desired/path/ ~or~ wget http://yourUserNameHere:yourSecretPasswordHere@yourSite.com/desired/path/
Categories: How-To's, Technology Tags: apache, Auth, Basic, Basic Auth, Digest, howto, Password, scrape, tips, wget
|
No comments
Author:
erics, April 26th, 2016
Add the following to either .htaccess or httpd.conf:
|
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 |
Categories: How-To's, Technology Tags: apache, Apache2, Compress, Compression, gzip, http, Performance, Speed, tuning, Web
|
No comments
Author:
erics, April 22nd, 2016
If when trying to use SVG as an image <img src=”image.svg”> or as a CSS background-image, the browser doesn’t display it, your web host is probably serving the SVG with the wrong content-type. Add this to your web server config or .htaccess file: AddType image/svg+xml .svg .svgz
Categories: How-To's, Technology Tags: .htaccess, apache, Background, Content, Content-Type, CSS, howto, html, Image, img, SVG, tips, Type, Web, Web server, XML
|
No comments