summaryrefslogtreecommitdiff
path: root/nginx.sh
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-08-18 12:09:30 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-08-18 12:09:30 -0400
commitce961bb5865b5d16d203365159ab173e67e34556 (patch)
tree9140826001e6478a6b3eb8fee4d8d478a61c090b /nginx.sh
parent780226fa442abda5cb5b1018e998f50e7985e908 (diff)
downloadhtml5ks-ce961bb5865b5d16d203365159ab173e67e34556.tar.xz
html5ks-ce961bb5865b5d16d203365159ab173e67e34556.zip
fix nginx.* to work better with slim nginx
also print warning if zopfli is not found
Diffstat (limited to 'nginx.sh')
-rwxr-xr-xnginx.sh36
1 files changed, 32 insertions, 4 deletions
diff --git a/nginx.sh b/nginx.sh
index e00f519..089bc67 100755
--- a/nginx.sh
+++ b/nginx.sh
@@ -1,8 +1,36 @@
-#!/bin/sh
-cd "`dirname $0`"
+#!/bin/bash
+
+set -e
+cd "$(dirname $0)"
+
+
# empty file
> nginx.gen.conf
-if nginx -V 2>&1 | grep -q -- --with-http_gzip_static_module; then
- echo "gzip_static on" >> 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
+
+
exec nginx -p "$PWD" -c nginx.conf