Skip to content

Instantly share code, notes, and snippets.

#zero downtime deployment nextjs without vercel
echo "Deploy starting..."
git pull
npm install || exit
BUILD_DIR=temp npm run build || exit
@anthumchris
anthumchris / README.md
Last active September 25, 2022 19:04
Clear Nginx Cache

Clearing Nginx's HTTP Cache

I recently implemented Nginx HTTP content caching on our WordPress web servers to improve page load speeds and eliminate redundant, unneeded server-side page rendering. Caching the pages was relatively straightforward, but clearing the cache required a custom workaround.

Nginx comes in two versions: free and “Nginx Plus” at $2,500/year. The free version of Nginx does not offer the needed cache-clearing features of Nginx Plus, and I wasn’t comfortable paying $20,000 for 8 instances without trying to build my own solution.

Our Nginx servers run as an HTTP proxy for multiple PHP/MySQL-backed WordPress sites. The goal was to cache the dynamic PHP HTML responses in Nginx and serve the HTML pages from Nginx to avoid redundant, CPU-intensive PHP renders.

Site Cache Configuration

The example below shows how PHP response caching is configured for a site (other nginx configuration details are excluded for brevity). A cache named cachedemo-prod is defined to store cached HTML f

@kocisov
kocisov / next_nginx.md
Last active August 2, 2024 13:02
How to setup next.js app on nginx with letsencrypt
@chranderson
chranderson / nvmCommands.js
Last active September 20, 2024 09:06
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@amboutwe
amboutwe / yoast_seo_admin_remove_columns.php
Last active September 17, 2024 19:22
Remove Yoast SEO columns from posts and pages
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO columns for all users site wide
* Credit: Andrew Norcross http://andrewnorcross.com/
* Last Tested: Sep 17 2024 using Yoast SEO 23.4 on WordPress 6.6.2
*
* If you have custom post types, you can add additional lines in this format
* add_filter( 'manage_edit-{$post_type}_columns', 'yoast_seo_admin_remove_columns', 10, 1 );
* replacing {$post_type} with the name of the custom post type.
@vwasteels
vwasteels / getMenuHierarchically.md
Last active June 28, 2022 13:12
Retrieve menu items hierarchically in Wordpress
/**
 * Get Menu Items From Location
 *
 * @param $location : location slug given as key in register_nav_menus
 */

function getMenuItemsFromLocation($location) {
	$theme_locations = get_nav_menu_locations();