|
33 | 33 | sed -i "s/\#gzip/gzip/" $CONF_NGINX_SERVER
|
34 | 34 | fi
|
35 | 35 |
|
36 |
| -if [[ $SERVER_ENABLE_BROTLI ]] |
37 |
| -then |
38 |
| - echo "[nginx] enabling brotli" |
39 |
| - TYPES_TO_COMPRESS="application\/javascript application\/json application\/rss+xml application\/vnd.ms-fontobject application\/x-font application\/x-font-opentype application\/x-font-otf application\/x-font-truetype application\/x-font-ttf application\/xhtml+xml application\/xml font\/opentype font\/otf font\/ttf image\/svg+xml image\/x-icon text\/css text\/javascript text\/plain text\/xml;" |
40 |
| - sed -i "s|#plugins_placeholder|#plugins_placeholder\nload_module modules/ngx_http_brotli_filter_module.so;\nload_module modules/ngx_http_brotli_static_module.so;\n|" $CONF_NGINX_SERVER |
41 |
| - sed -i "s/#brotli on;/brotli on;\n\ |
42 |
| - brotli_static on;\n\ |
43 |
| - brotli_comp_level 6;\n\ |
44 |
| - brotli_types ${TYPES_TO_COMPRESS}/" $CONF_NGINX_SERVER |
45 |
| -fi |
46 |
| - |
47 | 36 | if [[ $SERVER_KEEPALIVE ]]
|
48 | 37 | then
|
49 | 38 | echo "[nginx] setting keepalive ${SERVER_KEEPALIVE}"
|
|
95 | 84 | sed -i "s/^[ ]*listen ${CONTAINER_PORT}/ listen ${CONTAINER_PORT} ssl/" $CONF_NGINX_SITE
|
96 | 85 | fi
|
97 | 86 |
|
| 87 | +if [[ $SERVER_ENABLE_NGX_BROTLI ]]; |
| 88 | +then |
| 89 | + echo "[nginx] enabling nginx brotli module" |
| 90 | + # Enable the brotli module |
| 91 | + sed -i "s/#load_module modules\/ngx_http_brotli_/load_module modules\/ngx_http_brotli_/" $CONF_NGINX_SERVER |
| 92 | + |
| 93 | + # Enable brotli-specific configuration. All brotli configs begin with brotli* |
| 94 | + # Ref: https://github.com/google/ngx_brotli |
| 95 | + sed -i "s/#brotli/brotli/" $CONF_NGINX_SERVER |
| 96 | +fi |
| 97 | + |
98 | 98 | if [[ $SERVER_ENABLE_NGX_HTTP_JS ]];
|
99 | 99 | then
|
| 100 | + # Enable the njs module |
100 | 101 | echo "[nginx] enabling nginx njs module"
|
101 |
| - sed -i "s/#load_module/load_module/" $CONF_NGINX_SERVER |
| 102 | + sed -i "s/#load_module modules\/ngx_http_js_/load_module modules\/ngx_http_js_/" $CONF_NGINX_SERVER |
| 103 | +fi |
| 104 | + |
| 105 | +# Useful when you need to debug the contents of nginx.conf |
| 106 | +# |
| 107 | +# Should be the last entry in this script to ensure that all prior |
| 108 | +# modifications have been applied |
| 109 | +if [[ $SERVER_SHOW_NGINX_CONF ]]; |
| 110 | +then |
| 111 | + if [[ -f "$CONF_NGINX_SERVER" ]]; |
| 112 | + then |
| 113 | + echo "" |
| 114 | + echo "*** SERVER_SHOW_NGINX_CONF is set. Dumping $CONF_NGINX_SERVER ***" |
| 115 | + echo "" |
| 116 | + cat $CONF_NGINX_SERVER |
| 117 | + fi |
102 | 118 | fi
|
0 commit comments