Skip to content

Instantly share code, notes, and snippets.

View VirtuBox's full-sized avatar
🏠
Working from home

VirtuBox VirtuBox

🏠
Working from home
View GitHub Profile

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 / 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";
@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 / 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 / env.php
Created May 8, 2017 22:31
env.php configuration example for magento 2.1 with redis cache
<?php
return array (
'backend' =>
array (
'frontName' => 'youradmin-url',
),
'crypt' =>
array (
'key' => 'thelongkey',
),
@VirtuBox
VirtuBox / magento-easyengine.conf
Created May 8, 2017 22:28
Nginx configuration for magento 2.1 with EasyEngine
## Example configuration:
# upstream fastcgi_backend {
# # use tcp connection
# # server 127.0.0.1:9000;
# # or socket
# server unix:/var/run/php5-fpm.sock;
# }
# server {
# listen 80;
# server_name mage.dev;
@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

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 / 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