Skip to content

Instantly share code, notes, and snippets.

View rahmatov's full-sized avatar

Gani Rakhmatov rahmatov

View GitHub Profile
@haproxytechblog
haproxytechblog / blog20180913-01.cfg
Last active June 14, 2022 14:21
Introduction to HAProxy ACLs
acl is_static path -i -m beg /static/
@1hakr
1hakr / example.com
Last active January 31, 2024 01:16
Supercharge your NGIX config
proxy_cache_path /tmp/cacheapi levels=1:2 keys_zone=microcacheapi:100m max_size=1g inactive=1d use_temp_path=off;
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
location /api/ {
# Rate Limiting
limit_req zone=reqlimit burst=20; # Max burst of request
@voluntas
voluntas / sysctl.conf
Created October 14, 2017 13:07 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@KarelWintersky
KarelWintersky / gist:620390b5c1a83893d4e525c112b6e595
Created July 14, 2017 14:30
Backup MySQL to YandexDisk (OAuth)
#!/bin/bash
#
# # # # # # # # # # НАСТРОЙКИ ДОСТУПА К MYSQL # # # # # # # # # #
MYSQL_SERVER=localhost
MYSQL_USER=root
MYSQL_PASSWORD=password
MYSQL_DATABASES="--all-databases"
# Yandex.Disk настройки (как получить - см. https://oauth.yandex.ru/ и https://oauth.yandex.ru/authorize?response_type=token&client_id=?)
@jacefreeman
jacefreeman / gist:a83d0e95ce1c1dc949fe72284d04f265
Created April 14, 2017 00:34
Vyos OpenVPN Client Configuration for ExpressVPN
# Download the OVPN file from ExpressVPN for the server you wish to access https://www.expressvpn.com/setup#manual
# Create files for certs and keys, use vi or nano, example is vi
cd /config/auth
sudo vi ca.cert
# type i and paste in your client certificate after <cert> up to </cert>
# type :wq
sudo vi cert.crt
# type i and paste in your certificate authority after <ca> up to </ca>
@nrollr
nrollr / nginx.conf
Last active April 16, 2024 10:06
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@bftanase
bftanase / secure_link.php
Last active March 28, 2024 06:54
generate URL for nginx secure_link
@LouWii
LouWii / iptables-config-script
Last active June 29, 2023 13:45
Bash script to configure iptables for a web server. Some rules can be removed depending on used services.
#!/bin/sh
# Empty all rules
sudo iptables -t filter -F
sudo iptables -t filter -X
# Bloc everything by default
sudo iptables -t filter -P INPUT DROP
sudo iptables -t filter -P FORWARD DROP
sudo iptables -t filter -P OUTPUT DROP
#!/bin/bash
#
# Copyright (c) 2015, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@denji
denji / nginx-tuning.md
Last active April 11, 2024 06:45
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.