This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process mysqld with pidfile /var/run/mysqld/mysqld.pid | |
group database | |
group mysql | |
start program = "/etc/init.d/mysql start" | |
stop program = "/etc/init.d/mysql stop" | |
if failed host localhost port 3306 protocol mysql with timeout 15 seconds for 3 times within 4 cycles then restart | |
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 3 times within 4 cycles then restart | |
if 5 restarts with 5 cycles then timeout | |
depend mysql_bin | |
depend mysql_rc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* add this in the functions.php of theme/child theme/snippets plugin | |
* Schedule the daily event if necessary. | |
*/ | |
function schedule_delete_expired_coupons() { | |
if ( ! wp_next_scheduled( 'delete_expired_coupons' ) ) { | |
wp_schedule_event( time(), 'daily', 'delete_expired_coupons' ); | |
} | |
} | |
add_action( 'init', 'schedule_delete_expired_coupons' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## in the server block | |
# | |
# note: if you have posts with title matching these, turn them off or fine-tune | |
# them to exclude those | |
## Block SQL injections | |
location ~* union.*select.*\( { | |
access_log /var/log/nginx/blocked.log blocked; | |
deny all; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check: https://onexa.nl/wordpress/toolbar-link-redis-object-cache/ | |
/** | |
* Add a link to the Admin Toolbar to easily flush the Redis cache (Redis Object Cache plugin) | |
* | |
* @author Hiranthi Herlaar, onexa.nl | |
* | |
* @var $wp_admin_bar > https://codex.wordpress.org/Class_Reference/WP_Admin_Bar | |
**/ | |
function redis_add_toolbar_link( $wp_admin_bar ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CACHE WARMER script for XML Sitemaps with MULTIPLE SUB-SITEMAPS: | |
# from: https://gist.github.com/JPustkuchen/f185bee60c5a36211cdf6f1c8f6deebe | |
# chmod u+x | |
DOMAIN='https://www.xyz.com' | |
wget -q $DOMAIN/sitemap.xml --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read subsite; | |
do | |
echo --- Reading sub-sitemap: $subsite: --- | |
wget -q $subsite --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read line; | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## WordPress Plugin Installer using BASH and WP-CLI | |
# Make executable: chmod u+x wp-plugins | |
# remember change WPPATH | |
# array of plugin slugs to install | |
WPPLUGINS=( | |
advanced-database-cleaner basepress categorytinymce classic-editor code-snippets change-last-modified-date disqus-comment-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'phpmailer_init', 'set_phpmailer_details' ); | |
function set_phpmailer_details( $phpmailer ) { | |
$phpmailer->isSMTP(); | |
$phpmailer->Host = 'SMTP_endpoint'; //Amazon SES SMTP endpoint for your region | |
$phpmailer->SMTPAuth = true; | |
$phpmailer->Port = 587; | |
$phpmailer->Username = 'Amazon_SES_USERNAME'; | |
$phpmailer->Password = 'Amazon_SES_PASSWORD'; | |
$phpmailer->SMTPSecure = 'tls'; | |
$phpmailer->From = get_option('admin_email'); //your verified email address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget --spider -o wget.log -e robots=off -r -l 5 -p -S -T3 --header="X-Bypass-Cache: 1" -H --domains=example.tld --show-progress www.example.tld | |
# Options explained | |
# --spider: Crawl the site | |
# -o wget.log: Keep the log | |
# -e robots=off: Ignore robots.txt | |
# -r: specify recursive download | |
# -l 5: Depth to search. I.e 1 means 'crawl the homepages'. 2 means 'crawl the homepage and all pages it links to'... | |
# -p: get all images, etc. needed to display HTML page | |
# -S: print server response (to the log) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen [::]:80; # remove this if you don't want Matomo to be reachable from IPv6 | |
listen 80; | |
server_name analytics.example.com; | |
access_log /var/log/nginx/matomo.access.log; | |
error_log /var/log/nginx/matomo.error.log; | |
root /var/www/matomo/; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind 127.0.0.1 ::1 | |
protected-mode yes | |
port 6379 | |
tcp-backlog 511 | |
# unixsocket /var/run/redis/redis-server.sock | |
# unixsocketperm 700 | |
timeout 0 | |
tcp-keepalive 300 | |
daemonize yes |
NewerOlder