Skip to content

Instantly share code, notes, and snippets.

@nginx-gists
nginx-gists / ubuntu_install.sh
Last active Nov 23, 2020
Automating Installation of WordPress with NGINX Unit on Ubuntu
View ubuntu_install.sh
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ];then
>&2 echo "This script requires root level access to run"
exit 1
fi
if [ -z "${WORDPRESS_DB_PASSWORD}" ]; then
>&2 echo "WORDPRESS_DB_PASSWORD must be set"
>&2 echo "Here is a random one that you can paste:"
@nginx-gists
nginx-gists / app.go
Created Aug 11, 2020
Application Isolation with NGINX Unit
View app.go
package main
import (
"encoding/json"
"fmt"
"net/http"
"unit.nginx.org/go"
"os"
"strconv"
)
@nginx-gists
nginx-gists / ab_app.json
Last active Aug 10, 2020
Filesystem Isolation in NGINX Unit
View ab_app.json
{
"listeners": {
"*:80": {
"pass": "applications/ab_app"
}
},
"applications": {
"ab_app": {
"type": "php",
@nginx-gists
nginx-gists / 2_2_1_weights
Last active Jul 2, 2020
NGINX Unit 1.18.0 Adds Filesystem Isolation and Other Enhancements
View 2_2_1_weights
{
"servers": {
"192.168.0.100:8080": {
"weight": 2,
},
"192.168.0.101:8080": {
"weight": 2,
},
"192.168.0.102:8080"
}
@nginx-gists
nginx-gists / logging.conf
Created Jun 9, 2020
Announcing NGINX Plus R22
View logging.conf
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 / .unit.conf.json
Last active May 7, 2020
Building Application Stacks With NGINX Unit
View .unit.conf.json
{
"listeners": {
"*:8080": {
"pass": "routes/wordpress"
}
},
"routes": {
"wordpress": [
{
"match": {
@nginx-gists
nginx-gists / fallback
Created Apr 8, 2020
NGINX Unit 1.16.0 Introduces New Yet Familiar Features
View fallback
{
"action": {
"share": "/data/www/",
"fallback": {
"pass": "applications/php_blog"
}
}
}
@nginx-gists
nginx-gists / dynamic_grpc.conf
Last active Apr 7, 2020
Announcing NGINX Plus R21
View dynamic_grpc.conf
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 / config.json
Last active Mar 31, 2020
NGINX Unit Adds Assembly Language Support
View config.json
{
"listeners": {
"*:8081": {
"pass": "applications/hello-x64"
}
},
"applications": {
"hello-x64": {
"type": "asm",
"executable": "/path/to/hello"
@nginx-gists
nginx-gists / address_based_routing
Last active Jan 13, 2020
NGINX Unit 1.13.0 and 1.14.0 Introduce Reverse Proxying and Address-Based Routing
View address_based_routing
{
"routes": [
{
"match": {
"source": [
"*:8000",
"*:0-65535"
]
},
You can’t perform that action at this time.