-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nginx-json): new nginx optimized for serving JSON content effici…
…ently
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
!etc/nginx/ | ||
!data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM ghcr.io/alwatr/nginx-core:2.0.0 | ||
|
||
RUN rm -fv index.html _error.html | ||
COPY etc/nginx/ /etc/nginx/ | ||
COPY data/ . | ||
RUN ls -RlahF /etc/nginx /data | ||
|
||
# Default environment for nginx template | ||
ENV NGINX_CLIENT_MAX_BODY_SIZE=1k \ | ||
NGINX_SENDFILE=on \ | ||
NGINX_SENDFILE_MAX_CHUNK=2m \ | ||
NGINX_TCP_NOPUSH=on \ | ||
NGINX_TCP_NODELAY=on \ | ||
NGINX_OPEN_FILE_CACHE="max=5000 inactive=1h" \ | ||
NGINX_OPEN_FILE_CACHE_VALID=1s \ | ||
NGINX_OPEN_FILE_CACHE_MIN_USES=2 \ | ||
NGINX_OUTPUT_BUFFERS="8 8k" \ | ||
NGINX_EXPIRES_DYNAMIC=epoch \ | ||
NGINX_EXPIRES_STATIC=max \ | ||
NGINX_EXPIRES_DEFAULT=epoch \ | ||
NGINX_LIMIT_REQ_RATE=400 \ | ||
NGINX_LIMIT_REQ_BURST=1000 \ | ||
NGINX_DISABLE_SYMLINKS=if_not_owner | ||
|
||
ARG BUILD_REV | ||
ARG BUILD_DATE | ||
LABEL org.opencontainers.image.title="alwatr/nginx-ws" \ | ||
org.opencontainers.image.description="This is a high-performance version of NGINX, which has been enhanced by Alwatr for the purpose of serving JSON content efficiently." \ | ||
org.opencontainers.image.base.name="ghcr.io/alwatr/nginx-core:2.0.0" \ | ||
org.opencontainers.image.version="2.0.0" \ | ||
org.opencontainers.image.ref.name="2.0.0-nginx1.25.3-alpine3.18-slim" \ | ||
org.opencontainers.image.licenses="MIT" \ | ||
org.opencontainers.image.created=${BUILD_DATE} \ | ||
org.opencontainers.image.revision=${BUILD_REV} \ | ||
org.opencontainers.image.vendor="Alwatr" \ | ||
org.opencontainers.image.source="https://github.com/Alwatr/nginx" \ | ||
org.opencontainers.image.url="https://github.com/Alwatr/nginx" \ | ||
org.opencontainers.image.documentation="https://github.com/Alwatr/nginx" \ | ||
org.opencontainers.image.authors="S. Ali Mihandoost <[email protected]> (https://ali.mihandoost.com), S. Amir Mohammad Najafi <[email protected]> (https://njfamirm.ir/)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"ok": false, | ||
"statusCode": <!--# echo var="status" default="500" -->, | ||
"errorCode": "serve_error", | ||
"meta": { | ||
"server": "alwatr/storage", | ||
"status": "<!--# echo var="status_text" default="Something goes wrong." -->" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
nginx-json/etc/nginx/templates/location.d/10-error-page.conf.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 425 426 428 429 431 451 500 501 502 503 504 505 506 507 508 510 511 /_error.json; | ||
|
||
location = /_error.json { | ||
internal; | ||
ssi on; | ||
ssi_types *; | ||
auth_basic off; | ||
} |
5 changes: 5 additions & 0 deletions
5
nginx-json/etc/nginx/templates/location.d/90-home-json.conf.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
location = / { | ||
# return static json for home page | ||
default_type application/json; | ||
return 200 '{"ok": true, "data": "..:: Alwatr Accelerated Storage Server ::.."}'; | ||
} |