Skip to content

Commit 77a4f8f

Browse files
committed
Add stubs for the extenting NGINX config
Signed-off-by: Elijah Zupancic <[email protected]>
1 parent e853447 commit 77a4f8f

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

common/etc/nginx/templates/default.conf.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ server {
116116
error_page 404 @trailslashControl;
117117

118118
proxy_pass ${S3_SERVER_PROTO}://storage_urls$s3uri;
119+
120+
include /etc/nginx/conf.d/gateway/s3_location.conf;
119121
}
120122

121123
location @s3Listing {
@@ -164,6 +166,7 @@ server {
164166
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 500 501 502 503 504 505 506 507 508 509 510 511 =404 @error404;
165167

166168
proxy_pass ${S3_SERVER_PROTO}://storage_urls$s3Uri;
169+
include /etc/nginx/conf.d/gateway/s3listing_location.conf;
167170
}
168171

169172
location @error404 {
@@ -187,4 +190,6 @@ server {
187190
add_header Allow "GET, HEAD" always;
188191
return 405;
189192
}
193+
194+
include /etc/nginx/conf.d/gateway/s3_server.conf;
190195
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is intentional left as blank.
2+
# Use this file to add additional configuration to the "location @s3"
3+
# block with default.conf.template
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is intentional left as blank.
2+
# Use this file to add additional configuration to the "server"
3+
# block with default.conf.template
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is intentional left as blank.
2+
# Use this file to add additional configuration to the "location @s3Listing"
3+
# block with default.conf.template

docs/development.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22

33
## Extending the Gateway
44

5+
### Extending gateway configuration via container images
6+
7+
#### `conf.d` Directory
8+
9+
On the container image, all files with the extension `.conf` in the
10+
directory `/etc/nginx/conf.d` will be loaded into the configuration
11+
of the base `http` block within the main NGINX configuration.
12+
13+
This allows for extension of the configuration by adding additional
14+
configuration files into the container image extending the base
15+
gateway image.
16+
17+
#### Stub Files
18+
19+
On the container image there are three NGINX configuration stub files:
20+
21+
* [`/etc/nginx/conf.d/s3_server.conf`](/common/etc/nginx/templates/gateway/s3_location.conf.template)
22+
* [`/etc/nginx/conf.d/s3_location.conf`](/common/etc/nginx/templates/gateway/s3_server.conf.template)
23+
* [`/etc/nginx/conf.d/s3listing_location.conf`](/common/etc/nginx/templates/gateway/s3listing_location.conf.template)
24+
25+
Each of these files can be overwritten in a container image that inherits
26+
from the S3 Gateway container image, so that additional NGINX configuration
27+
directives can be inserted into the gateway configuration.
28+
29+
### Examples
30+
531
In the [examples/ directory](/examples), there are `Dockerfile` examples that
632
show how to extend the base functionality of the NGINX S3 Gateway by adding
733
additional modules.

0 commit comments

Comments
 (0)