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 / additionals.conf
Created July 17, 2017 09:22
WordPress Additionals directives for Nginx only with Plesk onyx
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
# Media: images, icons, video, audio, HTC
#location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
# expires 1M;
# access_log off;
# log_not_found off;
# add_header Pragma public;
@VirtuBox
VirtuBox / collabora-code.md
Created July 19, 2017 16:54
Collabora online for NextCloud with Docker and Nginx

launch your container

docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=yourdomain\\.tld" \
        -e "username=admin" -e "password=admin" --restart always --cap-add MKNOD collabora/code

nginx configuration

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;
<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
@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
@VirtuBox
VirtuBox / config.yml
Last active September 21, 2017 21:37
wp-cli easyengine fix
core download:
version: 4.8
# 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
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; }
# 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
@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