aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin/nginx-dev
diff options
context:
space:
mode:
Diffstat (limited to '.local/share/bin/nginx-dev')
-rwxr-xr-x.local/share/bin/nginx-dev9
1 files changed, 7 insertions, 2 deletions
diff --git a/.local/share/bin/nginx-dev b/.local/share/bin/nginx-dev
index 4e9825d..40e73ad 100755
--- a/.local/share/bin/nginx-dev
+++ b/.local/share/bin/nginx-dev
@@ -4,6 +4,8 @@ port=8080
try_files='/$uri /$uri.html /$uri/index.html =404'
access_log='/dev/stdout'
cache_control='
+ proxy_store off;
+ proxy_cache off;
add_header Last-Modified $date_gmt;
add_header Cache-Control "private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
if_modified_since off;
@@ -21,21 +23,23 @@ options:
-C enable server cache (disabled by default)
-v verbose mode (prints config before starting server)
-q quiet mode (disable access_log)
+ -x automatically open a browser
-h show this help
EOF
exit $1
}
ARGC=0
-while getopts hvp:Ct:q OPT; do
+while getopts hvp:Ct:qx OPT; do
[ $OPTIND -gt $ARGC ] && ARGC=$OPTIND
case $OPT in
h) usage 0 ;;
p) port="$OPTARG" ;;
t) try_files="$OPTARG" ;;
v) print_config=1 ;;
- C) cache_control="" ;;
+ C) cache_control='' ;;
q) access_log="/dev/null" ;;
+ x) open_browser=1 ;;
\?|*) usage 1 ;;
esac
done
@@ -76,6 +80,7 @@ http {
}
EOF
[ $print_config ] && cat "$config"
+[ $open_browser ] && (xdg-open "http://localhost:$port" 1> /dev/null 2> /dev/null &)
nginx -c "$config"
rm -f "$config" "$pidfile"