Skip to content

Instantly share code, notes, and snippets.

View TheLastCicada's full-sized avatar

Zachary Brown TheLastCicada

View GitHub Profile
@janeczku
janeczku / cloudfront-ip-ranges-updater.sh
Last active July 15, 2022 16:32
Cron script that updates CloudFront ip ranges for use with nginx real-ip module
#!/bin/bash
# (The MIT License)
#
# Copyright (c) 2015 Jan Broer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
server {
##DM - uncomment following line for domain mapping
#listen 80 default_server;
server_name example.com *.example.com ;
##DM - uncomment following line for domain mapping
#server_name_in_redirect off;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
server {
##DM - uncomment following line for domain mapping
#listen 80 default_server;
server_name example.com *.example.com ;
##DM - uncomment following line for domain mapping
#server_name_in_redirect off;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
@jeremyfelt
jeremyfelt / proxy-production.conf
Last active May 14, 2019 18:02
Nginx configuration to proxy 404 files locally to a production domain
# Adjust this to include any other necessary files.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
try_files $uri $uri/ @production;
}
location @production {
resolver 1.1.1.1;
proxy_pass http://{replace-with.domain.com}/$uri;