Skip to content

Commit 26b082c

Browse files
author
Bryan Latten
committed
Merge pull request #13 from bryanlatten/feature-sendfile
Nginx: allow runtime specification of sendfile
2 parents 131acb2 + e72f3d4 commit 26b082c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Variable | Example | Description
88
`SERVER_INDEX` | `SERVER_INDEX index.html index.html index.php` | Changes the default pages to hit for folder and web roots
99
`SERVER_APP_NAME` | `SERVER_APP_NAME='view'` | Sets a kv pair to be consumed by logging service for easy parsing and searching
1010
`SERVER_GZIP_OPTIONS` | `SERVER_GZIP_OPTIONS=1` | Allows default set of static content to be served gzipped
11+
`SERVER_SENDFILE` | `SERVER_SENDFILE=off` | Allows runtime to specify value of nginx's `sendfile` (default, on)
1112

1213

1314
### Runtime Commands

container/root/run.d/10-nginx.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ echo '[nginx] piping logs to STDOUT'
1919
sed -i "s/access_log \/var\/log\/nginx\/access\.log;/ log_format main \'\$remote_addr - \$remote_user [\$time_local] \"\$request\" \$status \$bytes_sent \"\$http_referer\" \"\$http_user_agent\" ${SERVER_APP_NAME}\';\n access_log \/dev\/stdout main;\n/" $CONFIG_SERVER
2020
sed -i "s/error_log [a-z\/\.\ \;]\+/error_log \/dev\/stdout info;/" $CONFIG_SERVER
2121

22+
if [[ $SERVER_SENDFILE ]]
23+
then
24+
echo "[nginx] server sendfile status is ${SERVER_SENDFILE}"
25+
sed -i "s/sendfile on/sendfile ${SERVER_SENDFILE}/" $CONFIG_SERVER
26+
fi
27+
2228
if [[ $SERVER_MAX_BODY_SIZE ]]
2329
then
2430
echo "[nginx] server client max body is ${SERVER_MAX_BODY_SIZE}"

0 commit comments

Comments
 (0)