mirror of
https://github.com/dokku/buildpack-nginx.git
synced 2025-09-09 18:34:23 +00:00
Compare commits
8 Commits
v26
...
05b3a5c841
Author | SHA1 | Date | |
---|---|---|---|
05b3a5c841 | |||
f415d7d80d | |||
cf60a30bc8 | |||
f77b6db3a0 | |||
f2bbc7f0a0 | |||
c1c5ed2d9e | |||
806f8f5b0a | |||
4e4c3824c5 |
@ -1,5 +1,5 @@
|
||||
---
|
||||
name: 'review-app'
|
||||
name: 'deploy'
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cloning repo
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
2
.github/workflows/review-app.yml
vendored
2
.github/workflows/review-app.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cloning repo
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
19
README.md
19
README.md
@ -30,7 +30,7 @@ You can override the nginx root via setting the `NGINX_ROOT` environment variabl
|
||||
# where the app is named `static-app`
|
||||
# and the root dir is _site
|
||||
dokku config:set static-app NGINX_ROOT=_site
|
||||
````
|
||||
```
|
||||
|
||||
### Default to index for history routing
|
||||
|
||||
@ -42,6 +42,23 @@ By default, this buildpack will 404 if a requested file is not found. For static
|
||||
dokku config:set static-app NGINX_DEFAULT_REQUEST=index.html
|
||||
```
|
||||
|
||||
### Custom nginx directives
|
||||
|
||||
You can configure following nginx directives via environment variables.
|
||||
|
||||
- `NGINX_WORKERS` : `worker_processes` directive
|
||||
- `NGINX_WORKER_CONNECTIONS` : `worker_connections` directive
|
||||
- `NGINX_CLIENT_BODY_TIMEOUT` : `client_body_timeout` directive
|
||||
- `NGINX_CLIENT_MAX_BODY_SIZE` : `client_max_body_size` directive (in MB)
|
||||
|
||||
```shell
|
||||
# where the app is named `static-app`
|
||||
dokku config:set static-app NGINX_WORKERS=4 \
|
||||
NGINX_WORKER_CONNECTIONS=1024 \
|
||||
NGINX_CLIENT_BODY_TIMEOUT=5 \
|
||||
NGINX_CLIENT_MAX_BODY_SIZE=1
|
||||
```
|
||||
|
||||
### Custom nginx config file
|
||||
|
||||
You may completely override the built-in nginx config by placing an `app-nginx.conf.sigil` file in the root, modeled after our own [`conf/app-nginx.conf.sigil`](https://github.com/dokku/buildpack-nginx/blob/master/conf/app-nginx.conf.sigil). This will be used inside of the container, and not by the host Dokku instance. See the [sigil project](https://github.com/gliderlabs/sigil) for more information concerning the sigil format.
|
||||
|
@ -174,7 +174,7 @@ cat <<EOF >"$BUILD_DIR/start_nginx"
|
||||
#!/usr/bin/env bash
|
||||
rm -f /app/nginx/nginx.conf
|
||||
if [[ -f /app/nginx/app-nginx.conf.sigil ]]; then
|
||||
/app/sigil/sigil -f /app/nginx/app-nginx.conf.sigil NGINX_ROOT="\$NGINX_ROOT" NGINX_DEFAULT_REQUEST="\$NGINX_DEFAULT_REQUEST" PORT="\$PORT" | cat -s > /app/nginx/nginx.conf
|
||||
/app/sigil/sigil -f /app/nginx/app-nginx.conf.sigil NGINX_ROOT="\$NGINX_ROOT" NGINX_DEFAULT_REQUEST="\$NGINX_DEFAULT_REQUEST" NGINX_WORKERS="\$NGINX_WORKERS" NGINX_WORKER_CONNECTIONS="\$NGINX_WORKER_CONNECTIONS" NGINX_CLIENT_BODY_TIMEOUT="\$NGINX_CLIENT_BODY_TIMEOUT" NGINX_CLIENT_MAX_BODY_SIZE="\$NGINX_CLIENT_MAX_BODY_SIZE" PORT="\$PORT" | cat -s > /app/nginx/nginx.conf
|
||||
else
|
||||
erb /app/nginx/nginx.conf.erb > /app/nginx/nginx.conf
|
||||
fi
|
||||
|
@ -1,19 +1,38 @@
|
||||
worker_processes 1;
|
||||
{{ if ne $.NGINX_WORKERS "" }}
|
||||
worker_processes {{ $.NGINX_WORKERS }};
|
||||
{{ else }}
|
||||
worker_processes 1;
|
||||
{{ end }}
|
||||
error_log stderr;
|
||||
pid nginx.pid;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
{{ if ne $.NGINX_WORKER_CONNECTIONS "" }}
|
||||
worker_connections {{ $.NGINX_WORKER_CONNECTIONS }};
|
||||
{{ else }}
|
||||
worker_connections 768;
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
http {
|
||||
{{ if ne $.NGINX_CLIENT_BODY_TIMEOUT "" }}
|
||||
client_body_timeout {{ $.NGINX_CLIENT_BODY_TIMEOUT }};
|
||||
{{ else }}
|
||||
client_body_timeout 5;
|
||||
{{ end }}
|
||||
types_hash_max_size 2048;
|
||||
include mime.types;
|
||||
charset UTF-8;
|
||||
|
||||
server {
|
||||
listen {{ $.PORT }};
|
||||
server_name _;
|
||||
{{ if ne $.NGINX_CLIENT_MAX_BODY_SIZE "" }}
|
||||
client_max_body_size {{ $.NGINX_CLIENT_MAX_BODY_SIZE }}M;
|
||||
{{ else }}
|
||||
client_max_body_size 1M;
|
||||
{{ end }}
|
||||
{{ if ne $.NGINX_ROOT "" }}
|
||||
root /app/www/{{ $.NGINX_ROOT }};
|
||||
{{ else }}
|
||||
|
Reference in New Issue
Block a user