This commit is contained in:
Zsolt Ero
2023-12-20 14:16:51 +01:00
parent b467f0b33c
commit 6abbb2e571
4 changed files with 86 additions and 69 deletions

View File

@@ -1,20 +1,20 @@
map "" $empty { map "" $empty {
default ""; default "";
} }
server { server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server; listen [::]:80 default_server;
listen 443 ssl default_server; listen 443 ssl default_server;
listen [::]:443 ssl default_server; listen [::]:443 ssl default_server;
http2 on; http2 on;
server_name _; server_name _;
ssl_ciphers aNULL; ssl_ciphers aNULL;
ssl_certificate /etc/nginx/ssl/dummy.crt; ssl_certificate /etc/nginx/ssl/dummy.crt;
ssl_certificate_key /etc/nginx/ssl/dummy.key; ssl_certificate_key /etc/nginx/ssl/dummy.key;
return 444; return 444;
} }

View File

@@ -2,68 +2,68 @@
user nginx; user nginx;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
worker_processes auto; worker_processes auto;
worker_rlimit_nofile 300000; # needs to be < ulimit -n worker_rlimit_nofile 300000; # needs to be < ulimit -n
error_log /data/nginx/logs/nginx-error.log warn; error_log /data/nginx/logs/nginx-error.log warn;
events { events {
worker_connections 40000; worker_connections 40000;
multi_accept on; multi_accept on;
} }
http { http {
# aggressive caching for read-only sources # aggressive caching for read-only sources
open_file_cache max=1000000 inactive=60m; open_file_cache max=1000000 inactive=60m;
open_file_cache_valid 60m; open_file_cache_valid 60m;
open_file_cache_min_uses 1; open_file_cache_min_uses 1;
open_file_cache_errors on; open_file_cache_errors on;
server_tokens off; server_tokens off;
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
charset utf-8; charset utf-8;
sendfile on; sendfile on;
tcp_nopush on; tcp_nopush on;
tcp_nodelay on; tcp_nodelay on;
reset_timedout_connection on; reset_timedout_connection on;
send_timeout 20; send_timeout 20;
max_ranges 0; max_ranges 0;
gzip on; gzip on;
gzip_comp_level 1; gzip_comp_level 1;
gzip_types application/json; gzip_types application/json;
log_format access_json '{' log_format access_json '{'
'"time": "$time_iso8601", ' '"time": "$time_iso8601", '
'"msec": "$msec", ' '"msec": "$msec", '
'"status": $status, ' '"status": $status, '
'"request": "$request", ' '"request": "$request", '
'"request_method": "$request_method", ' '"request_method": "$request_method", '
'"request_time": $request_time, ' '"request_time": $request_time, '
'"body_bytes_sent": $body_bytes_sent, ' '"body_bytes_sent": $body_bytes_sent, '
'"remote_addr": "$remote_addr", ' '"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", ' '"remote_user": "$remote_user", '
'"http_referrer": "$http_referer", ' '"http_referrer": "$http_referer", '
'"http_x_forwarded_for": "$http_x_forwarded_for", ' '"http_x_forwarded_for": "$http_x_forwarded_for", '
'"http_user_agent": "$http_user_agent", ' '"http_user_agent": "$http_user_agent", '
'"host": "$host", ' '"host": "$host", '
'"uri": "$uri", ' '"uri": "$uri", '
'"http_cf_connecting_ip": "$http_cf_connecting_ip", ' '"http_cf_connecting_ip": "$http_cf_connecting_ip", '
'"http_cf_ray": "$http_cf_ray", ' '"http_cf_ray": "$http_cf_ray", '
'"http_cf_ipcountry": "$http_cf_ipcountry", ' '"http_cf_ipcountry": "$http_cf_ipcountry", '
'"scheme": "$scheme", ' '"scheme": "$scheme", '
'"http_host": "$http_host"' '"http_host": "$http_host"'
'}'; '}';
access_log /data/nginx/logs/nginx-access.log access_json buffer=32k; access_log /data/nginx/logs/nginx-access.log access_json buffer=32k;
include /data/nginx/config/*; include /data/nginx/config/*;
include /data/nginx/sites/*; include /data/nginx/sites/*;
} }

7
lint.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
ruff check --fix .
ruff format .
# https://github.com/soulteary/nginx-formatter
nginx-formatter

View File

@@ -1,17 +1,27 @@
server { server {
server_name ofm tiles.openfreemaps.org;
# test with
# curl -H "Host: ofm" http://localhost/planet/20231208_091355/tiles/11/637/1141.pbf
server_name ofm tiles.openfreemaps.org;
# test with
# curl -H "Host: ofm" http://localhost/planet/20231208_091355/tiles/11/637/1141.pbf
#access_log /data/ofm/logs/nginx-access.log access_json; #access_log /data/ofm/logs/nginx-access.log access_json;
access_log off; access_log off;
error_log /data/ofm/logs/nginx-error.log; error_log /data/ofm/logs/nginx-error.log;
location /planet/20231208_091355 { location /planet/20231208_091355 {
gzip off; gzip off;
alias /data/ofm/runs/planet_20231208_091355/mnt_rw/extract; alias /data/ofm/runs/planet_20231208_091355/mnt_rw/extract;
autoindex on; # Enables listing of directory autoindex on; # Enables listing of directory
} }
}
location / {
try_files $uri $uri/ @empty;
}
location @empty {
default_type text/plain; # TODO
return 200 "''";
}
}