Skip to content

Instantly share code, notes, and snippets.

View sgomez84's full-sized avatar

Siddharth Gomez sgomez84

View GitHub Profile
@sgomez84
sgomez84 / nginx-tuning.md
Created April 5, 2021 17:01 — 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.

sudo amazon-linux-extras install nginx1
sudo yum install --enablerepo=ius-archive php56u
[program:nodeapp]
command = node /data/nodeapp/report_node_app/bin/www
directory = /data/nodeapp/report_node_app
user = root
autostart = true
autorestart = true
stdout_logfile = /data/log/supervisor/nodeapp.log
stderr_logfile = /data/log/supervisor/nodeapp_err.log
environment = NODE_ENV="production"
ffmpeg -ss 01:23:45 -i input.mp4 -vframes 1 -q:v 2 output.jpg
@sgomez84
sgomez84 / nginx.conf
Last active September 4, 2023 00:34
Nginx Proxy Pass to PHP-FPM
upstream phpfpm {
#server unix:/var/run/php5-fpm.sock;
#avoid sockets for nginx-fpm on Linux, they are good for BSD
server 127.0.0.1:9000;
}
server {
listen 8080;
server_name sumhr.com;
rewrite ^(.*) $scheme://www.sumhr.com$1 permanent;
@sgomez84
sgomez84 / app.js
Last active August 29, 2015 14:07 — forked from jgoux/app.js
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@sgomez84
sgomez84 / nginx.conf
Last active August 29, 2015 14:06 — forked from calebwoods/nginx.conf
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
ko.utils.addOrRemoveItem = function (array, value, included) { /* .. */ }
ko.utils.anyDomNodeIsAttachedToDocument = function (nodes) { /* .. */ }
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh