Skip to content

Instantly share code, notes, and snippets.

View arifhazwan's full-sized avatar

Arif Hazwan arifhazwan

  • Penang, Malaysia
View GitHub Profile
@arifhazwan
arifhazwan / object-cache.php
Created March 13, 2019 22:01
Redis Object Cache
<?php
/*
Plugin Name: Redis Object Cache Drop-In
Plugin URI: http://wordpress.org/plugins/redis-cache/
Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, HHVM, replication, clustering and WP-CLI.
Version: 1.4.1
Author: Till Krüss
Author URI: https://till.im/
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@arifhazwan
arifhazwan / woocommerce.vcl
Created March 7, 2019 12:27 — forked from lukecav/woocommerce.vcl
Varnish v4 VCL for WooCommerce Stores - Beta
/* SET THE HOST AND PORT OF WooCommerce
* *********************************************************/
backend default {
.host = "127.0.0.1";
.port = "8080";
}
# SET THE ALLOWED IP OF PURGE REQUESTS
# ##########################################################
@arifhazwan
arifhazwan / disable-wp-load-css.php
Created March 3, 2019 23:16
Wordpress Functions Disable CSS Load
add_filter( 'style_loader_src', function($href){
if(strpos($href, "stylesheet.min.css") == true) {
return false;
}
return $href;
});
@arifhazwan
arifhazwan / install-comodo-ssl-cert-for-nginx.rst
Created March 3, 2019 06:43 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@arifhazwan
arifhazwan / nginx-tuning.md
Created February 24, 2019 20:46 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@arifhazwan
arifhazwan / default.vcl_PREFACE.md
Created February 23, 2019 22:24 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 3 minute (180 sec) cache time. You can safely increase this to 5 mins for less busier sites or drop it to 1 min or even 30s for high traffic sites.

This configuration requires an HTTP Header and a user cookie to identify if a user is logged in a site, in order to bypass caching overall (see how it's done in the Joomla section). If your CMS provides a way to add these 2 requirements, then you can use this configuration to speed up your site or entire server. You can even exclude the domains you don't want to cach

@arifhazwan
arifhazwan / wp_disable_feed-functions.php
Created January 23, 2019 20:53
Wordpress Disable Feed
function wpfeed_disable() {
wp_die( __( 'Not available, check out <a href="'. esc_url( 'https://www.facebook.com/' ) .'">Facebook</a>!' ) );
}
add_action('do_feed', 'wpfeed_disable', 1);
add_action('do_feed_rdf', 'wpfeed_disable', 1);
add_action('do_feed_rss', 'wpfeed_disable', 1);
add_action('do_feed_rss2', 'wpfeed_disable', 1);
add_action('do_feed_atom', 'wpfeed_disable', 1);
add_action('do_feed_rss2_comments', 'wpfeed_disable', 1);
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶