Skip to content

Instantly share code, notes, and snippets.

View RyanDsilva's full-sized avatar
:octocat:
Always Learning

Ryan Dsilva RyanDsilva

:octocat:
Always Learning
View GitHub Profile
@RyanDsilva
RyanDsilva / https-only-nginx.conf
Last active July 14, 2020 09:39
Only the HTTPS part of the configuration for NGINX
server {
listen 80;
listen [::]:80;
server_name DOMAIN_NAME;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
@RyanDsilva
RyanDsilva / https-nginx.conf
Last active July 14, 2020 09:39
HTTPS configuration for NGINX
upstream nodejs {
ip_hash;
server localhost:5000;
server localhost:5001;
}
server {
listen 80;
listen [::]:80;
server_name DOMAIN_NAME;
@RyanDsilva
RyanDsilva / gzip-nginx.conf
Last active July 13, 2020 16:58
NGINX gzip compression
server {
...
...
gzip on;
gzip_types text/plain application/xml application/json;
gzip_comp_level 9;
gzip_min_length 1000;
...
@RyanDsilva
RyanDsilva / proxylb-nginx.conf
Created July 6, 2020 20:28
Reverse Proxy + Load Balancing NGINX configuration
upstream nodejs {
server localhost:5000;
server localhost:5001;
}
server {
listen 80;
listen [::]:80;
server_name SERVER_IP;
root /home/ryan;
@RyanDsilva
RyanDsilva / socket-proxylb-nginx.conf
Created July 6, 2020 20:27
SocketIO + Reverse Proxy + Load Balancing NGINX configuration file
upstream nodejs {
ip_hash;
server localhost:5000;
server localhost:5001;
}
server {
listen 80;
listen [::]:80;
server_name SERVER_IP;
@RyanDsilva
RyanDsilva / pm2-ecosystem.config.js
Last active July 5, 2020 15:35
Basic PM2 configuration for a single application deployment
module.exports = {
apps: [
{
name: "server",
script: "server.js",
instances: "max",
exec_mode: "cluster",
env_production: {
NODE_ENV: "production",
PORT: 5000,