diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2014-04-16 15:17:31 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2014-04-16 15:17:31 -0400 |
commit | e417662dce5cae2e95ef98ee38baa8f53a02b9d5 (patch) | |
tree | dce94fb8524dece7e3fcc677ec0cf908a6ec2a97 /nginx.sh | |
parent | 6a50d79523cf215001cdd55c74c040bd410775df (diff) | |
download | html5ks-e417662dce5cae2e95ef98ee38baa8f53a02b9d5.tar.xz html5ks-e417662dce5cae2e95ef98ee38baa8f53a02b9d5.zip |
mbleh
Diffstat (limited to 'nginx.sh')
-rwxr-xr-x | nginx.sh | 52 |
1 files changed, 25 insertions, 27 deletions
@@ -1,35 +1,33 @@ #!/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." - +V="$(nginx -V 2>&1)" + +check() { + if [[ "$V" == *"$1"* ]]; then + if [[ -n "$3" ]]; then + echo "$2" >> nginx.gen.conf + fi + else + if [[ -n "$3" ]]; then + echo "$3" >> nginx.gen.conf + fi + if [[ -n "$4" ]]; then + echo "$4" >&2 + fi + fi +} + +check --with-http_gzip_static_module "gzip_static on;" "" "The gzip_static module for nginx is highly recommended to reduce server load and utilize zopfli's higher compression ratio." + +check --without-http_proxy_module "" "proxy_temp_path /dev/null;" +check --without-http_fastcgi_module "" "fastcgi_temp_path /dev/null;" +check --without-http_scgi_module "" "scgi_temp_path /dev/null;" +check --without-http_uwsgi_module "" "uwsgi_temp_path /dev/null;" + +echo "Ignore any following messages from nginx about the error log." >&2 exec nginx -p "$PWD/" -c nginx.conf |