summaryrefslogtreecommitdiff
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
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
-rw-r--r--nginx.conf7
-rwxr-xr-xnginx.sh36
-rwxr-xr-xunrpyc/find-gzip.sh4
3 files changed, 38 insertions, 9 deletions
diff --git a/nginx.conf b/nginx.conf
index c0a88bd..0576dbd 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -7,13 +7,11 @@ error_log /dev/null;
http {
+ include nginx.gen.conf;
+
access_log /dev/null;
error_log stderr info;
client_body_temp_path /dev/null;
- proxy_temp_path /dev/null;
- fastcgi_temp_path /dev/null;
- scgi_temp_path /dev/null;
- uwsgi_temp_path /dev/null;
types {
application/font-woff woff;
@@ -37,7 +35,6 @@ http {
default_type application/octet-stream;
gzip on;
- include nginx.gen.conf;
gzip_types application/javascript application/json image/svg+xml text/plain text/css;
gzip_vary on;
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
diff --git a/unrpyc/find-gzip.sh b/unrpyc/find-gzip.sh
index 26e60c0..2ee9064 100755
--- a/unrpyc/find-gzip.sh
+++ b/unrpyc/find-gzip.sh
@@ -4,7 +4,11 @@ GZIP="$(command -v gzip)"
if [ -n $ZOPFLI ]; then
echo "$ZOPFLI"
elif [ -n $GZIP ]; then
+ echo >&2 "Consider obtaining zopfli (https://code.google.com/p/zopfli/)"
+ echo >&2 "for higher compression ratios (about 5% decrease in size of"
+ echo >&2 "script.json.gz."
echo "$GZIP -9"
else
+ echo >&2 "Could not find zopfli or gzip, aborting."
exit 1
fi