Skip to content

Instantly share code, notes, and snippets.

@Hadryan
Hadryan / webconfig.sh
Last active November 22, 2018 17:24 — forked from kerberjg/webconfig.sh
Basic Ubuntu VPS Webserver configuration script
sudo su
#Install various tools
apt-get update
apt-get upgrade -y
apt-get install -y imagemagick build-essential htop git fail2ban sendmail libreadline-dev libncurses5-dev libpcre3 libpcre3-dev libssl-dev perl make ffmpeg libfaac-dev libfdk-aac-dev openssl libxml2 libc6 libc6-dev libaio1 libaio-dev libxslt1-dev zlib1g zlib1g-dev libgd-dev libgeoip-dev libpcre++-dev ffmpeg
#Compile
#https://www.digitalocean.com/community/tutorials/how-to-use-the-openresty-web-framework-for-nginx-on-ubuntu-16-04
@Hadryan
Hadryan / filter.d_nginx-auth.conf
Created September 8, 2017 06:18 — forked from JulienBlancher/filter.d_nginx-auth.conf
Fail2ban Config with Nginx and SSH
#
# Auth filter /etc/fail2ban/filter.d/nginx-auth.conf:
#
# Blocks IPs that makes too much accesses to the server
#
[Definition]
failregex = ^<HOST> -.*"(GET|POST).*HTTP.*"
ignoreregex =
@Hadryan
Hadryan / nginx.conf
Created September 14, 2017 13:03 — forked from exodus4d/nginx.conf
nginx.conf for Pathfinder (Nginx v1.11.8)
# nginx Configuration File
# http://wiki.nginx.org/Configuration
# Run as a less privileged user for security reasons.
user nginx nginx;
# How many worker threads to run;
# "auto" sets it to the number of CPU cores available in the system, and
# offers the best performance. Don't set it higher than the number of CPU
# cores if changing this parameter.
@Hadryan
Hadryan / nginx.conf
Created September 14, 2017 18:51 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@Hadryan
Hadryan / nginx-tuning.md
Created September 14, 2017 19:12 — forked from denji/nginx-tuning.md
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.

@Hadryan
Hadryan / nginx-microcaching.txt
Created October 15, 2017 20:37 — forked from ansulev/nginx-microcaching.txt
Micro caching for Nginx
TODO: Compare with: https://www.howtoforge.com/why-you-should-always-use-nginx-with-microcaching
mkdir /usr/share/nginx/cache
#mkdir /var/run/nginx/cache
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_cache microcache;
fastcgi_cache_key $scheme$host$request_uri$request_method;
fastcgi_cache_valid 200 301 302 30s;
worker_processes 1;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nodelay on;
@Hadryan
Hadryan / nginx.conf
Created October 15, 2017 20:52 — forked from ansulev/nginx.conf
Ultimate nginx configuration for improved security and performance.
#
# /etc/nginx/nginx.conf
#
user http;
worker_processes 1;
worker_priority -10;
worker_rlimit_nofile 260000;
timer_resolution 100ms;
@Hadryan
Hadryan / README.md
Created October 24, 2017 13:17 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.