aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin/nginx-dev
blob: f135cf66bf754ad4bf38e5eb53313cabd2e80ab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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"