-
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.
Update dependencies: bump @types/node to 22.10.10, @types/geojson to …
…7946.0.16, and zod-openapi to 4.2.3
- Loading branch information
1 parent
04fd2d7
commit 6d713dd
Showing
16 changed files
with
347 additions
and
62 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
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
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
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
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
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
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
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
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
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,168 @@ | ||
# Massive thank you to @ricardojorgerm and @tiagogaspar8 | ||
# for the help in creating this nginx configuration file. | ||
|
||
|
||
# # # | ||
# USER | ||
|
||
user nginx; | ||
|
||
|
||
# # # | ||
# WORKER PROCESSES | ||
|
||
worker_processes auto; | ||
|
||
|
||
# # # | ||
# DEFAULTS | ||
|
||
error_log /var/log/nginx/error.log notice; | ||
pid /var/run/nginx.pid; | ||
|
||
|
||
# # # | ||
# EVENTS | ||
|
||
events { | ||
use epoll; | ||
worker_connections 2048; | ||
} | ||
|
||
|
||
# # # | ||
# HTTP | ||
|
||
http { | ||
|
||
# # # | ||
# MIME TYPES | ||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
|
||
# # # | ||
# LOGS | ||
|
||
log_format main '[$time_iso8601] | IP: $remote_addr | Request: $status [$upstream_cache_status] "$request" | Referer: "$http_referer" | User Agent: "$http_user_agent"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
|
||
# # # | ||
# FILE DESCRIPTOR SETTINGS | ||
|
||
aio threads; | ||
directio 512M; | ||
output_buffers 2 1M; | ||
sendfile on; | ||
tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
|
||
# # # | ||
# RATE LIMITS | ||
|
||
limit_req_zone global zone=global:10m rate=500r/s; | ||
limit_req zone=global burst=200 delay=2; | ||
|
||
limit_req_zone $http_x_forwarded_for zone=ip:16m rate=50r/s; | ||
limit_req zone=ip burst=50 delay=2; | ||
|
||
limit_req_status 429; | ||
|
||
|
||
# # # | ||
# COMPRESSION | ||
|
||
gzip on; | ||
gzip_types application/json; | ||
|
||
|
||
|
||
|
||
|
||
# # # # # # # # # # # # # # # # # # # # # # | ||
# # # API SERVER | ||
|
||
|
||
# # # | ||
# CACHE | ||
|
||
proxy_cache_path /var/cache/nginx/api levels=1:2 keys_zone=api_cache:512m inactive=360m; | ||
|
||
|
||
# # # | ||
# UPSTREAM | ||
|
||
upstream api_upstream { | ||
zone upstreams 64K; | ||
server server:5050 max_fails=2 fail_timeout=2s; | ||
keepalive 10; | ||
} | ||
|
||
|
||
# # # | ||
# DEFAULT HTTP SERVER | ||
# Redirect to HTTPS | ||
|
||
server { | ||
|
||
listen 80; | ||
listen [::]:80; | ||
server_name api.cmet.pt; | ||
server_tokens off; | ||
http2 on; | ||
|
||
# Do not skip cache by default | ||
set $skip_cache 0; | ||
set $skip_reason ""; | ||
|
||
# Cache configuration | ||
etag on; | ||
proxy_cache api_cache; | ||
proxy_cache_key "$scheme$request_method$host$request_uri"; | ||
proxy_cache_valid 200 60m; | ||
proxy_cache_valid any 30s; | ||
proxy_cache_lock on; | ||
proxy_cache_lock_age 30s; | ||
proxy_cache_lock_timeout 90s; | ||
proxy_cache_use_stale error timeout updating; | ||
proxy_cache_revalidate on; | ||
proxy_cache_bypass $skip_cache; | ||
|
||
# Proxy configuration | ||
proxy_http_version 1.1; | ||
proxy_connect_timeout 10s; | ||
proxy_send_timeout 20s; | ||
proxy_read_timeout 20s; | ||
proxy_set_header Connection ""; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_next_upstream error timeout http_500; | ||
|
||
|
||
location / { | ||
if ($request_method = 'OPTIONS') { | ||
add_header 'Access-Control-Allow-Origin' "*" always; | ||
add_header 'Access-Control-Allow-Credentials' 'true' always; | ||
add_header 'Access-Control-Allow-Headers' "Origin, X-Requested-With, Content-Type, Accept" always; | ||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | ||
add_header 'Access-Control-Max-Age' 1728000; | ||
add_header 'Content-Type' 'text/plain; charset=utf-8'; | ||
add_header 'Content-Length' 0; | ||
return 204; | ||
} | ||
# Add headers | ||
add_header CMET-Cache-Skip $skip_reason; | ||
add_header CMET-Cache-Status $upstream_cache_status; | ||
add_header Access-Control-Allow-Origin "*" always; | ||
add_header Strict-Transport-Security "max-age=31536000" always; | ||
# Proxy connect | ||
proxy_pass http://api_upstream; | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.