Skip to content

Instantly share code, notes, and snippets.

@nginx-gists
nginx-gists / cafe‑ingress.yaml
Last active November 10, 2022 23:59
NGINX and NGINX Plus Ingress Controllers for Kubernetes Load Balancing
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: cafe-ingress
spec:
tls:
- hosts:
- cafe.example.com
secretName: cafe-secret
rules:
@nginx-gists
nginx-gists / limit_conn.conf
Last active November 11, 2022 00:00
Announcing NGINX Plus Release 20
limit_conn_zone $binary_remote_addr zone=by_ip:10m;
server {
listen 80;
location / {
limit_conn by_ip 10;
limit_conn_dry_run on;
if ($limit_conn_status = REJECTED_DRY_RUN) {
limit_rate 100;
@nginx-gists
nginx-gists / address_based_routing
Last active November 11, 2022 00:00
NGINX Unit 1.13.0 and 1.14.0 Introduce Reverse Proxying and Address-Based Routing
{
"routes": [
{
"match": {
"source": [
"*:8000",
"*:0-65535"
]
},
@nginx-gists
nginx-gists / config.json
Last active November 11, 2022 00:01
NGINX Unit Adds Assembly Language Support
{
"listeners": {
"*:8081": {
"pass": "applications/hello-x64"
}
},
"applications": {
"hello-x64": {
"type": "asm",
"executable": "/path/to/hello"
@nginx-gists
nginx-gists / dynamic_grpc.conf
Last active November 11, 2022 00:01
Announcing NGINX Plus R21
keyval_zone zone=grpc-greeter:128K type=ip timeout=48h;
keyval $remote_addr $greeter_upstream zone=grpc-greeter;
server {
listen 50052 ssl http2;
ssl_certificate /etc/ssl/certificate.crt;
ssl_certificate_key /etc/ssl/privateKey.key;
location /helloworld.Greeter {
grpc_pass grpc://$greeter_upstream; #TLS termination
@nginx-gists
nginx-gists / fallback
Created April 8, 2020 21:04
NGINX Unit 1.16.0 Introduces New Yet Familiar Features
{
"action": {
"share": "/data/www/",
"fallback": {
"pass": "applications/php_blog"
}
}
}
@nginx-gists
nginx-gists / .unit.conf.json
Last active November 11, 2022 00:02
Building Application Stacks With NGINX Unit
{
"listeners": {
"*:8080": {
"pass": "routes/wordpress"
}
},
"routes": {
"wordpress": [
{
"match": {
@nginx-gists
nginx-gists / logging.conf
Created June 9, 2020 02:09
Announcing NGINX Plus R22
js_import logging.js; # Load this JS file as the 'logging' module
js_set $raw_headers_in logging.rawHeadersOnError;
log_format json escape=none '{"response":'
'{"timestamp":"$time_iso8601","status":$status},'
'"request":'
'{"client":"$remote_addr","uri":"$request_uri","headers":$raw_headers_in}}';
server {
listen 80;
@nginx-gists
nginx-gists / 2_2_1_weights
Last active November 11, 2022 00:03
NGINX Unit 1.18.0 Adds Filesystem Isolation and Other Enhancements
{
"servers": {
"192.168.0.100:8080": {
"weight": 2,
},
"192.168.0.101:8080": {
"weight": 2,
},
"192.168.0.102:8080"
}
@nginx-gists
nginx-gists / ab_app.json
Last active November 11, 2022 00:04
Filesystem Isolation in NGINX Unit
{
"listeners": {
"*:80": {
"pass": "applications/ab_app"
}
},
"applications": {
"ab_app": {
"type": "php",