Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
feat(router): configurable gzip settings
Browse files Browse the repository at this point in the history
Fixes #884
  • Loading branch information
johanneswuerbach committed May 13, 2014
1 parent 9698f42 commit f845dc8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
7 changes: 7 additions & 0 deletions router/bin/boot
Expand Up @@ -28,6 +28,13 @@ sleep $(($ETCD_TTL+1))
if ! etcdctl --no-sync -C $ETCD ls /deis/services >/dev/null 2>&1; then
etcdctl --no-sync -C $ETCD mkdir /deis/services || true >/dev/null 2>&1
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port ${PORT:-80} >/dev/null
etcdctl --no-sync -C $ETCD set $ETCD_PATH/gzip on >/dev/null
etcdctl --no-sync -C $ETCD set $ETCD_PATH/gzipHttpVersion 1.0 >/dev/null
etcdctl --no-sync -C $ETCD set $ETCD_PATH/gzipCompLevel 2 >/dev/null
etcdctl --no-sync -C $ETCD set $ETCD_PATH/gzipProxied any >/dev/null
etcdctl --no-sync -C $ETCD set $ETCD_PATH/gzipVary on >/dev/null
etcdctl --no-sync -C $ETCD set $ETCD_PATH/gzipDisable "\"msie6\"" >/dev/null
etcdctl --no-sync -C $ETCD set $ETCD_PATH/gzipTypes "application/x-javascript, application/xhtml+xml, application/xml, application/xml+rss, application/json, text/css, text/javascript, text/plain, text/xml" >/dev/null
fi

# wait for confd to run once and install initial templates
Expand Down
1 change: 1 addition & 0 deletions router/conf.d/nginx.conf.toml
Expand Up @@ -6,6 +6,7 @@ gid = 0
mode = "0644"
keys = [
"/deis/services",
"/deis/router"
]
#check_cmd = "/usr/sbin/nginx -t -c {{ .src }}"
reload_cmd = "/usr/sbin/nginx -s reload"
29 changes: 18 additions & 11 deletions router/templates/nginx.conf
Expand Up @@ -6,29 +6,36 @@ worker_processes 4;
pid /run/nginx.pid;

events {
worker_connections 768;
# multi_accept on;
worker_connections 768;
# multi_accept on;
}

http {
# basic settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
gzip on;
gzip_disable "msie6";

include /etc/nginx/mime.types;
default_type application/octet-stream;
default_type application/octet-stream;

{{ if .deis_router_gzip }}
gzip {{ .deis_router_gzip }};
gzip_comp_level {{ .deis_router_gzipCompLevel }};
gzip_disable {{ .deis_router_gzipDisable }};
gzip_http_version {{ .deis_router_gzipHttpVersion }};
gzip_types {{ .deis_router_gzipTypes }};
gzip_proxied {{ .deis_router_gzipProxied }};
gzip_vary {{ .deis_router_gzipVary }};
{{ end }}

# send logs to STDOUT so they can be seen using 'docker logs'
access_log /dev/stdout;
error_log /dev/stdout;


server {
listen 80 default_server;
server_name _; # will never match
Expand Down

0 comments on commit f845dc8

Please sign in to comment.