Last active
November 11, 2022 00:23
-
-
Save nginx-gists/62558f37d51ff710798872b086e92f69 to your computer and use it in GitHub Desktop.
NGINX Unit Greets Autumn 2022 with New Features (a Statistics Engine!) and Exciting Plans
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"action": [ | |
{ | |
"pass": "applications/auth_check" | |
}, | |
{ | |
"pass": "applications/my_app" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hellonjs = {} | |
hellonjs.hello = function(vars) { | |
if ('unitvar' in vars) { | |
return vars.unitvar; | |
} else { | |
return 'default'; | |
} | |
} | |
export default hellonjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"match": { | |
"uri": "~(?<unitvar>.*)" | |
}, | |
"action": { | |
"share": "`/www/html${hellonjs.hello(vars)}`" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"match": { | |
"uri": "/app/old_path" | |
}, | |
"action": { | |
"rewrite": "/app/new_path", | |
"pass": "routes" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"connections": { | |
"accepted": 1067, | |
"active": 13, | |
"idle": 4, | |
"closed": 1050 | |
}, | |
"requests": { | |
"total": 1307 | |
}, | |
"applications": { | |
"wp": { | |
"processes": { | |
"running": 14, | |
"starting": 0, | |
"idle": 4 | |
}, | |
"requests": { | |
"active": 10 | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"action": { | |
"share": "/www$uri", | |
"chroot": "/www/data/$host/" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"action": { | |
"return": 301, | |
"location": "https://$host$request_uri" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"access_log": { | |
"path": "/var/log/unit/access.log", | |
"format": "{ \"remote_addr\":\"$remote_addr\", "time\":\"$time_local\", \"request\":\"$request_line\", \"response\":\"$status\", \"header_referer\":\"$header_referer\", \"header_user_agent\":\"$header_user_agent\" }" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"listeners": { | |
"*:80": { | |
"pass": "routes/my-app", | |
"forwarded": { | |
"client_ip": "X-Forwarded-For", | |
"protocol": "X-Forwarded-Proto", | |
"recursive": false, | |
"source": [ | |
"198.51.100.1-198.51.100.254", | |
"!198.51.100.128/26", | |
"203.0.113.195" | |
] | |
} | |
} | |
}, | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a discussion of these files, see NGINX Unit Greets Autumn 2022 with New Features (a Statistics Engine!) and Exciting Plans