diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-25 13:46:40 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-25 13:46:40 +0100 |
commit | bd30257f7c456f8a885726483eec6d857aea67d2 (patch) | |
tree | 71860b567f6b530cc28c1c640e9a7996e2df70b2 /.local/share/bin | |
parent | c1824f85429f8f52672545a8eaf0d8e8980c604d (diff) |
add nginx-dev script for quickly launching nginx development server
Diffstat (limited to '.local/share/bin')
-rwxr-xr-x | .local/share/bin/nginx-dev | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/.local/share/bin/nginx-dev b/.local/share/bin/nginx-dev new file mode 100755 index 0000000..f135cf6 --- /dev/null +++ b/.local/share/bin/nginx-dev @@ -0,0 +1,37 @@ +#!/bin/sh +port=8080 +config="$(mktemp)" +pidfile="$(mktemp)" +try_files='/$uri /$uri.html /$uri/index.html =404' + +cat << EOF > "$config" +worker_processes 1; +daemon off; +pid $pidfile; + +events { + worker_connections 1024; +} + +http { + types_hash_max_size 4096; + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log /dev/stdout; + + server { + listen $port; + listen [::]:$port; + + root $PWD; + + location / { + try_files $try_files; + } + } +} +EOF +nginx -c "$config" + +rm -f "$config" "$pidfile" |