Skip to content

Instantly share code, notes, and snippets.

View wesort's full-sized avatar

Ben Edmonds wesort

View GitHub Profile
@wesort
wesort / .htaccess
Created October 14, 2019 21:48
Apache .htaccess to redirect www to naked domain and remove file extensions
ErrorDocument 404 /404.html
#
RewriteEngine on
RewriteBase /
#
# Redirect all www traffic to non-www (naked domain)
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#
#
@wesort
wesort / imagick3.4.3-PHP7.2-forge.sh
Created October 22, 2019 10:30 — forked from rostockahoi/imagick3.4.3-PHP7.2-forge.sh
Install Imagick 3.4.3 on PHP 7.2 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.3.tgz
tar xvzf imagick-3.4.3.tgz
@wesort
wesort / live.robots.txt
Created December 12, 2019 15:35
A sample robots.txt file for a production site
# robotstxt.org/
User-agent: *
Disallow:
# Update the domain below
Host: https://example.co.uk
Sitemap: https://example.co.uk/sitemap
@wesort
wesort / dev.robots.txt
Last active December 12, 2019 15:40
A sample robots.txt file for a development site
# robotstxt.org/
User-agent: *
Disallow: /
# Allow Twitter access for validation testing
# https://cards-dev.twitter.com/validator
User-agent: Twitterbot
Disallow:
@wesort
wesort / live.env
Created December 12, 2019 15:46
Environment file for a production website running Statamic v2
APP_ENV=production
SITE_URL=https://example.co.uk
STACHE_ALWAYS_UPDATE=true
STATIC_CACHING_ENABLED=false
DEBUG=false
DEBUG_BAR=false
@wesort
wesort / dev.env
Last active December 12, 2019 15:57
Environment file for a development website running Statamic v2
APP_ENV=dev
SITE_URL=https://dev.example.co.uk
STACHE_ALWAYS_UPDATE=true
STATIC_CACHING_ENABLED=false
@wesort
wesort / .gitignore
Created December 12, 2019 16:01
.gitignore for Statamic v2
# Things for git to not bother with
#
# To avoid dev code being indexed #
robots.txt
#
# OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
@wesort
wesort / statamic-v3-nginx.conf
Last active April 10, 2025 18:28
nginx.conf adjustments for Statamic deployed to Digitalocean using Laravel Forge
# Add to bottom just before closing `}`:
# Enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
gzip_vary on;
# Expire headers on static assets
# CSS and Javascript
@wesort
wesort / refresh.sh
Created September 20, 2022 10:59
Refresh utility for Statamic v3
php artisan cache:clear # Clear the Laravel application cache.
php artisan config:cache # Clear and refresh the Laravel config cache.
php artisan route:cache # Clear and refresh the Laravel route cache.
php artisan statamic:stache:warm # Warm the Statamic stache.
php artisan statamic:search:update --all # Update the search index.
php artisan statamic:static:clear # Clear the Statamic static cache (if you use this).
#php artisan statamic:static:warm --queue # Warm the Statamic static cache (if you use this).
echo 'warming /work ...'
curl -# https://example.com/large-page > /dev/null
echo '/work is warmed.'

Deployment

Creating and configuring a new site / environment occurs occasionally. Often, to update the underlying server software.

This site has been built with: