Skip to content

Instantly share code, notes, and snippets.

@dinhkk
dinhkk / nginx-tuning.md
Created January 24, 2019 07:36 — 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.

Install fail2ban

yum install epel-release
sudo nano /etc/fail2ban/jail.local
[DEFAULT]
# Ban hosts for one hour:

1. display all opened ports

lsof -PiTCP -sTCP:LISTEN

2. disable httpd default

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
@dinhkk
dinhkk / mysql tunner.md
Last active January 24, 2018 04:09 — forked from insytes/mysqldump-ignore-multiple-tables
mysqldump ignore multiple tables

rsync - copy / synchronization

copy file: copy file 'backup.18-11-2017_09:40:15.fbsale.sql' from remote server to local file 'www/backup.18-11-2017_09:40:15.fbsale.sql'

rsync -avzP root@{server-ip}:/data/backup/backup.18-11-2017_09:40:15.fbsale.sql /var/www/backup.18-11-2017_09:40:15.fbsale.sql

copy folder: copy all files from remote server's folder 'backup', to local folder 'backup'

@dinhkk
dinhkk / letenscript.md
Last active October 16, 2017 07:27
command create ssl with letsencrypt

./letsencrypt-auto certonly -a webroot --webroot-path=/var/www/webrtc -d webrtcdemo.tk -d www.webrtcdemo.tk

create file /etc/nginx/snippets/ssl.conf

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;

ssl_protocols TLSv1.2;
@dinhkk
dinhkk / docker-comman.md
Last active April 19, 2018 03:28
docker comman

How to run a docker centos 7 lastest

1 Pull an image centos7 from docker hub : https://hub.docker.com/_/centos/

docker pull centos

2 build a docker container from pulled image

@dinhkk
dinhkk / xdebug and phpstorm
Last active August 4, 2017 04:05
xdebug - phpstorm
1. create web application server
2. create sftp tunner to connect
3. mwnu: Run => Run web server validate to pass all requires
4. Config php CLI Setting => Language / Framework
Settinh for xdebug.ini
xdebug.ini
zend_extension=/usr/lib64/php/modules/xdebug.so
[xdebug]
xdebug.remote_autostart=1 ;
@dinhkk
dinhkk / Install-php7.md
Created July 28, 2017 04:17 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions

Config permissions for shared folder Source : https://stackoverflow.com/questions/37871470/how-to-change-permission-of-vmwares-shared-folder Command: vmhgfs-fuse .host:/ /mnt/hgfs -o uid=1000 -o gid=1000 -o umask=0033

Install vmware tools

yum install perl gcc make kernel-headers kernel-devel -y
yum install libmspack-devel xerces-c-devel libxml-security-c-devel gtkmm24-devel procps-ng-devel libdnet-devel libXtst-devel libsigc++20-devel pam-devel fuse-devel
yum install CUnit-devel