Skip to content

Instantly share code, notes, and snippets.

Patrick Nommensen pnommensen

View GitHub Profile
View gist:b05044982b9fa423666d
Verifying that +pnommensen is my blockchain ID. https://onename.com/pnommensen
@pnommensen
pnommensen / gist:707b5519766ba45366dd
Last active Jan 24, 2019
Ghost CMS with NGINX for Maximum Performance
View gist:707b5519766ba45366dd

Full blog post can be found here: http://pnommensen.com/2014/09/07/high-performance-ghost-configuration-with-nginx/

Ghost is an open source platform for blogging founded by John O'Nolan and Hannah Wolfe. It's a node.js application and therefore works great in conjunction with nginx. This guide will will help you create a high performance nginx virtual host configuration for Ghost.

"Don't use #nodejs for static content" - @trevnorris. If #nginx isn't sitting in front of your node server, you're probably doing it wrong.

— Bryan Hughes (@nebrius) August 30, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

The node.js application runs on a port on your server

@pnommensen
pnommensen / WordPress functions.php 403 status incorrect login
Created Jul 10, 2014
WordPress functions.php 403 status incorrect login
View WordPress functions.php 403 status incorrect login
function my_login_failed_403() {
status_header( 403 );
}
add_action( 'wp_login_failed', 'my_login_failed_403' );
View nginx ssl spdy
## Use the Nginx Helper plugin to define cache purge rules and purge cache from dashboard
## Add the following three lines to /etc/nginx/nginx.conf
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
#inactive == if the page isn't accessed once during this time, it's deleted.
#keys_zone == name of the zone and max space allocation. If you have high ram, can mount as tmpfs.
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
server {
@pnommensen
pnommensen / varnish pass large files
Created Feb 7, 2014
pass large files for varnish
View varnish pass large files
sub vcl_fetch {
# Bypass cache for files > 10 MB
if (std.integer(beresp.http.Content-Length, 0) > 10485760) {
return (hit_for_pass);
}
}
You can’t perform that action at this time.