Skip to content

Instantly share code, notes, and snippets.

@amichaelgrant
amichaelgrant / gist:90d99d7d5d48bf8fd209
Created November 11, 2014 17:41
failed (104: Connection reset by peer) while reading response header from upstream, client:
failed (104: Connection reset by peer) while reading response header from upstream, client:
If you are getting the above error in nginx logs running in from of upstream servers you may consider doing this as it worked for me:
check the ulimit on the machines and ensure it is high enough to handle the load coming in. 'ulimit' on linux, I am told determines the maximum number of open files the kernel can handle.
The way I did that?
modifying limits: for open files:
--------------------------------
add or change this line in /etc/systcl.conf
fs.file-max = <limit-number>
@amichaelgrant
amichaelgrant / gist:5866230
Created June 26, 2013 09:50
Configuring Nginx for Apache Tomcat 7
Configuring Nginx for Apache Tomcat 7
September 23, 2011 Java, NginX, Tomcat, Ubuntu 19 comments
Apache Tomcat can be the first choice of an Application Server for someone new to Java world. There are obviously other servers such as JBoss Application Server and IBM WebSphere but those may be slightly difficult for a newbie.
In some situations, like when we are serving a few websites with Nginx over port 80 (HTTP), it is required to configure Nginx in order to serve our Java web application which is running on Apache Tomcat. It is basically using Nginx as a Reverse Proxy This can be done with a new server section in Nginx configuration file (it is in /etc/nginx/sites-available/default by default) :
server {
listen mysite.com:80;
server_name mysite.com;
@amichaelgrant
amichaelgrant / OS X network optimize.txt
Created June 17, 2019 20:00 — forked from snoby/OS X network optimize.txt
OSX Sierra Network Performance Tweaks
#
# Reboot into recovery mode (cmd +r ) and in the terminal
#
nvram boot-args="serverperfmode=1 ncl=262144"
#reboot
#
# In regular mode
@amichaelgrant
amichaelgrant / nginx-geoip-module.md
Created September 9, 2018 07:29 — forked from VirtuBox/nginx-geoip-module.md
How to configure GeoIP module for Nginx

Create a folder to store the databases :

mkdir -p /usr/share/GeoIP

Download Country IP database

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
@amichaelgrant
amichaelgrant / nginx.conf
Created October 25, 2017 09:13 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@amichaelgrant
amichaelgrant / supervisor.conf
Created April 21, 2017 23:04 — forked from tsabat/supervisor.conf
Sample supervisor config file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@amichaelgrant
amichaelgrant / performance.txt
Created April 21, 2017 20:13 — forked from dstroot/performance.txt
Performance Tuning your TCP Stack
#!/bin/bash
echo "*****************************************"
echo " Based on information from Google"
echo " http://dev.chromium.org/spdy/spdy-best-practices"
echo "*****************************************"
sudo su
yum –y update
echo "*****************************************"
echo " Changing initcwnd and initrwnd"
echo " Step 1: check route settings."
> console.log(new Buffer("Hello World").toString('base64'));
SGVsbG8gV29ybGQ=
> console.log(new Buffer("SGVsbG8gV29ybGQ=", 'base64').toString('ascii'))
Hello World
https://kernelnewbies.org/OutreachyfirstpatchSetup?action=show&redirect=OPWfirstpatchSetup
sudo apt-get install git-core build-essential autoconf automake libtool libncurses5 libncurses5-dev make libjpeg-dev pkg-config unixodbc unixodbc-dev zlib1g-dev libcurl4-openssl-dev libexpat1-dev libssl-dev libtiff4-dev libx11-dev unixodbc-dev python2.7-dev zlib1g-dev libzrtpcpp-dev libasound2-dev libogg-dev libvorbis-dev libperl-dev libgdbm-dev libdb-dev python-dev uuid-dev bison autoconf g++ libncurses-dev