summaryrefslogtreecommitdiff
path: root/nginx.sh
blob: 6c70f47caf77b9751d87d43ff5d286de0d1bbe95 (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
#!/bin/bash

set -e
cd "$(dirname $0)"

# empty file
> nginx.gen.conf

V=$(nginx -V 2>&1)

if echo ${V} | grep -q -- --with-http_gzip_static_module; then
  echo "gzip_static on;" >> nginx.gen.conf
else
  echo >&2 "The gzip_static module for nginx is highly recommended to reduce server load and utilize zopfli's higher compression ratio."
fi

if ! echo ${V} | grep -q -- --without-http_proxy_module; then
  echo "proxy_temp_path /dev/null;" >> nginx.gen.conf
fi

if ! echo ${V} | grep -q -- --without-http_fastcgi_module; then
  echo "fastcgi_temp_path /dev/null;" >> nginx.gen.conf
fi

if ! echo ${V} | grep -q -- --without-http_scgi_module; then
  echo "scgi_temp_path /dev/null;" >> nginx.gen.conf
fi

if ! echo ${V} | grep -q -- --without-http_uwsgi_module; then
  echo "uwsgi_temp_path /dev/null;" >> nginx.gen.conf
fi

echo >&2 "Ignore the following message from nginx about the error log, if any."

exec nginx -p "$PWD" -c nginx.conf