NGINX S3 Gateway
Learn how to configure the NGINX S3 Gateway for use with Filebase.
NGINX is open-source web server software that can be used for HTTP caching, load balancing, reverse proxying, and media streaming. NGINX can be used to act as a caching gateway for content stored in a private bucket. By using NGINX, your content isn’t susceptible to public discovery on the Internet, and caching helps you save on your bandwidth charges. Additional benefits include security control, compression and content optimization, and access to internal applications.
To do this, the NGINX S3 Gateway can be used. This S3 gateway implementation includes the following features:
- Support for a single S3 bucket.
- Caches content for 1 hour.
- Supports NGINX open source and NGINX plus.
- Uses GET and HEAD requests only.
- Is not configured with SSL/TLS.
Read below to learn how to configure the NGINX S3 Gateway for use with Filebase.
git clone https://github.com/nginxinc/nginx-s3-gateway.git
cd nginx-s3-gateway
This key pair can be found in the F5 Customer Portal if you are a NGINX Plus user, or this key pair can be copied from a certificate generator. This certificate and key pair will need to be named
nginx-repo.crt
and nginx-repo.key
respectively.Using Docker BuildKit is recommended since it supports passing a NGINX Plus license file into the container build. Use the following BuildKit command:
DOCKER_BUILDKIT=1 docker build -f Dockerfile.buildkit.plus -t nginx-plus-s3-gateway --secret id=nginx-crt,src=plus/etc/ssl/nginx/nginx-repo.crt --secret id=nginx-key,src=plus/etc/ssl/nginx/nginx-repo.key --squash .
Alternatively, the container can be built without BuildKit using the following command:
docker build -f Dockerfile.plus -t nginx-plus-s3-gateway .
Enter the following text into this file:
S3_BUCKET_NAME=filebase-bucket-name
S3_ACCESS_KEY_ID=filebase-access-key
S3_SECRET_KEY=filebase-secret-ke
S3_SERVER=s3.filebase.com
S3_SERVER_PORT=443
S3_SERVER_PROTO=https
S3_REGION=us-east-1
AWS_SIGS_VERSION=4
ALLOW_DIRECTORY_LIST=true
Replace the following values:
- S3_BUCKET_NAME: Your Filebase bucket name.
- S3_ACCESS_KEY_ID: Your Filebase access key.
- S3_SECRET_KEY: Your Filebase secret key.
If using NGINX Open Source, use the command:
docker run -it --env-file ./s3-settings.env -p8080:80 nginxinc/nginx-s3-gateway
If using NGINX Plus, use the command:
docker run -it --env-file ./s3-settings.env -p8080:80 nginx-plus-s3-gateway
- Create configuration files such as
gzip_compression.conf
and store them in the./etc/nginx/conf.d
directory. - Then, add the following lines into your Dockerfile, which will automatically add any files with the .conf extension from the local directory:
FROM nginxinc/nginx-s3-gateway
COPY etc/nginx/conf.d /etc/nginx/conf.d
If you have any questions, please join our Discord server, or send us an email at [email protected]
Last modified 3mo ago