Skip to content

Instantly share code, notes, and snippets.

@ntamvl
ntamvl / ubuntu-16-increase-maximum-file-open-limit-ulimit-n.md
Last active July 26, 2021 10:06
Ubuntu 16 – how to increase maximum file open limit ( ulimit -n )

Ubuntu 16 – how to increase maximum file open limit ( ulimit -n )

If you are setting up nginx,chances are you will discover your worker_connections is at some low number, such as 1024. You can’t increase this number unless you increase kernel limit as well. First of all run cat /proc/sys/fs/file-max to discover your maximum limit.

abc@ubuntu:~$ cat /proc/sys/fs/file-max
1048576
abc@ubuntu:~$ ulimit -n
1024
@duminhtam
duminhtam / nginx.conf
Created February 15, 2017 18:12 — 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
@nicokaiser
nicokaiser / client.js
Created April 11, 2012 21:05
node.js 0.6.x garbage collector fail
var WebSocket = require('ws')
// open 200 connections that close after 5 seconds
for (var i = 0; i < 200; i++) { openWs() }
function openWs() {
var ws = new WebSocket('ws://localhost:8080')
ws.on('open', function() {
ws.send('hello')
setTimeout(function() { ws.close(); }, 5000)
@micho
micho / nginx.conf
Last active October 15, 2025 07:47 — forked from unixcharles/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf: