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
@VirtuBox
VirtuBox / nginx-geoip-module.md
Last active January 24, 2024 08:44
How to configure GeoIP module for Nginx

Create a folder to store the databases :

mkdir -p /usr/share/GeoIP

Download Country IP database

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
@VirtuBox
VirtuBox / panel.ini
Last active December 15, 2017 11:07
Plesk Onyx panel.ini custom - No ads, No tracking, Automatic updates
[ext-letsencrypt]
renew-before-expiration = 45
rsa-key-size = 4096
[ext-security-advisor]
promoteSymantec = false
[ext-catalog]
contextAds = off
@VirtuBox
VirtuBox / bench.sh
Last active November 2, 2017 11:42
Linux server benchmark with Sysbench
#!/bin/bash
apt update && apt install sysbench -y &>/dev/null
sysbench --test=cpu --cpu-max-prime=20000 run
sysbench --test=fileio --file-total-size=20G prepare
sysbench --test=fileio --file-total-size=20G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
sysbench --test=fileio --file-total-size=20G cleanup
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
./speedtest-cli --share
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
location ~* "(eval\()" { deny all; }
location ~* "(127\.0\.0\.1)" { deny all; }
location ~* "([a-z0-9]{2000})" { deny all; }
location ~* "(javascript\:)(.*)(\;)" { deny all; }
location ~* "(base64_encode)(.*)(\()" { deny all; }
location ~* "(GLOBALS|REQUEST)(=|\[|%)" { deny all; }
location ~* "(<|%3C).*script.*(>|%3)" { deny all; }
location ~ "(\\|\.\.\.|\.\./|~|`|<|>|\|)" { deny all; }
location ~* "(boot\.ini|etc/passwd|self/environ)" { deny all; }
location ~* "(thumbs?(_editor|open)?|tim(thumb)?)\.php" { deny all; }
# NGINX CONFIGURATION FOR COMMON LOCATION
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
# Basic locations files
location = /favicon.ico {
access_log off;
log_not_found off;
expires max;
}
location = /robots.txt {
# Some WordPress plugin gererate robots.txt file
@VirtuBox
VirtuBox / config.yml
Last active September 21, 2017 21:37
wp-cli easyengine fix
core download:
version: 4.8
@VirtuBox
VirtuBox / isso.service
Last active October 19, 2017 14:02
Isso service for systemd on Ubuntu 16.04 LTS
[Unit]
Description=lightweight Disqus alternative
[Service]
User=isso
Environment="ISSO_SETTINGS=/etc/isso.d/foo.example.cfg;/etc/isso.d/other.bar.cfg"
ExecStart=/usr/local/bin/gunicorn --log-file /var/log/isso.log isso.dispatch -b localhost:8080
[Install]
WantedBy=multi-user.target
<VirtualHost *:443>
ServerName office.nextcloud.com:443
# SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
SSLEngine on
SSLCertificateFile /path/to/signed_certificate
SSLCertificateChainFile /path/to/intermediate_certificate
SSLCertificateKeyFile /path/to/private/key
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SH
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# redirection http vers https
server {
listen 80;
listen [::]:80;
server_name www.votredomaine.com votredomaine.com;
return 301 https://votredomaine.com$request_uri;