Skip to content

Instantly share code, notes, and snippets.

View VirtuBox's full-sized avatar
🚀
Back to work

VirtuBox VirtuBox

🚀
Back to work
View GitHub Profile
@VirtuBox
VirtuBox / nginx-wordpress-settings
Created August 5, 2016 21:02
WordPress optimized settings for Nginx
gzip on;
gzip_comp_level 6;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;
add_header X-Frame-Options "SAMEORIGIN" always;

install git

  apt-get install git

clone letsencrypt

git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

setup letsencrypt with your domain

cd /opt/letsencrypt

@VirtuBox
VirtuBox / install-Plesk.md
Last active August 23, 2016 15:09
install Plesk 12.5 or Plesk Onyx in a single command

auto-install Plesk 12.5

sh <(curl http://autoinstall.plesk.com/one-click-installer || wget -O - http://autoinstall.plesk.com/one-click-installer)

auto-install Plesk Onyx

sh <(curl http://autoinstall.plesk.com/one-click-installer || wget -O - http://autoinstall.plesk.com/one-click-installer) --tier testing

run Plesk 12.5 with Docker

@VirtuBox
VirtuBox / optipng-jpg.sh
Created October 7, 2016 07:23
Simple script to optimize your images with optipng and jpegoptim
#!/bin/bash
cd /var/www
find . -name *.jp* | xargs jpegoptim --strip-all -m76
find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve
@VirtuBox
VirtuBox / benchmarkvps.md
Created August 20, 2016 01:55
Benchmark your VPS

with vps bench

bash <(wget --no-check-certificate -O - https://raw.github.com/mgutz/vpsbench/master/vpsbench)

with speedtest

apt-get install -y python git
git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install

cd speedtest-cli

@VirtuBox
VirtuBox / 22222
Created May 25, 2017 10:56
protected area nginx configuration with easyengine
# EasyEngine admin NGINX CONFIGURATION
server {
listen 22222 default_server ssl http2;
access_log /var/log/nginx/22222.access.log rt_cache;
error_log /var/log/nginx/22222.error.log;
ssl_certificate /var/www/22222/cert/22222.crt;
@VirtuBox
VirtuBox / functions.md
Last active June 6, 2017 22:28
Remove Query strings and add featured images in WordPress feeds

WordPress Optimization

Remove Query strings on static assets

Add featured images in wordpress feeds

Add this code in your theme functions.php

//remove queries from static assets
function _remove_script_version( $src ){
@VirtuBox
VirtuBox / browser-cache.md
Created June 6, 2017 22:35
Nginx - Allow browser cache for static assets

Nginx to set the Expires HTTP header and the max-age directive of the Cache-Control HTTP header of static files

Add the following rules to your nginx configuration

# images, icons, video, audio, css, js
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|css|js)$ {
	expires 1M;
	access_log off;
	add_header Cache-Control "public";

Configure Diffie-Hellman (DH) key exchange parameters

mkdir /etc/nginx/ssl
cd /etc/nginx/ssl 
openssl dhparam 4096 -out dhparam.pem

create a modern-ssl.conf file for Nginx

@VirtuBox
VirtuBox / gzip-cache.conf
Created June 13, 2017 22:11
Enable Gzip compression and allow browser cache for static files
# Enable Gzip compression
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types
application/atom+xml