diff --git a/config/nginx/default_disable.conf b/config/nginx/default_disable.conf index 45092c5..fecac0d 100644 --- a/config/nginx/default_disable.conf +++ b/config/nginx/default_disable.conf @@ -1,20 +1,20 @@ map "" $empty { - default ""; + default ""; } 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; - http2 on; + listen 443 ssl default_server; + listen [::]:443 ssl default_server; + http2 on; - server_name _; + server_name _; - ssl_ciphers aNULL; - ssl_certificate /etc/nginx/ssl/dummy.crt; - ssl_certificate_key /etc/nginx/ssl/dummy.key; + ssl_ciphers aNULL; + ssl_certificate /etc/nginx/ssl/dummy.crt; + ssl_certificate_key /etc/nginx/ssl/dummy.key; - return 444; + return 444; } diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf index 9df3f8c..57887eb 100644 --- a/config/nginx/nginx.conf +++ b/config/nginx/nginx.conf @@ -2,68 +2,68 @@ user nginx; pid /var/run/nginx.pid; - 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; events { - worker_connections 40000; - multi_accept on; + worker_connections 40000; + multi_accept on; } http { - # aggressive caching for read-only sources - open_file_cache max=1000000 inactive=60m; - open_file_cache_valid 60m; - open_file_cache_min_uses 1; - open_file_cache_errors on; + # aggressive caching for read-only sources + open_file_cache max=1000000 inactive=60m; + open_file_cache_valid 60m; + open_file_cache_min_uses 1; + open_file_cache_errors on; - server_tokens off; + server_tokens off; - include /etc/nginx/mime.types; - default_type application/octet-stream; + include /etc/nginx/mime.types; + default_type application/octet-stream; - charset utf-8; + charset utf-8; - sendfile on; - tcp_nopush on; - tcp_nodelay on; + sendfile on; + tcp_nopush on; + tcp_nodelay on; - reset_timedout_connection on; - send_timeout 20; + reset_timedout_connection on; + send_timeout 20; - max_ranges 0; + max_ranges 0; - gzip on; - gzip_comp_level 1; - gzip_types application/json; + gzip on; + gzip_comp_level 1; + gzip_types application/json; - log_format access_json '{' - '"time": "$time_iso8601", ' - '"msec": "$msec", ' - '"status": $status, ' - '"request": "$request", ' - '"request_method": "$request_method", ' - '"request_time": $request_time, ' - '"body_bytes_sent": $body_bytes_sent, ' - '"remote_addr": "$remote_addr", ' - '"remote_user": "$remote_user", ' - '"http_referrer": "$http_referer", ' - '"http_x_forwarded_for": "$http_x_forwarded_for", ' - '"http_user_agent": "$http_user_agent", ' - '"host": "$host", ' - '"uri": "$uri", ' - '"http_cf_connecting_ip": "$http_cf_connecting_ip", ' - '"http_cf_ray": "$http_cf_ray", ' - '"http_cf_ipcountry": "$http_cf_ipcountry", ' - '"scheme": "$scheme", ' - '"http_host": "$http_host"' - '}'; + log_format access_json '{' + '"time": "$time_iso8601", ' + '"msec": "$msec", ' + '"status": $status, ' + '"request": "$request", ' + '"request_method": "$request_method", ' + '"request_time": $request_time, ' + '"body_bytes_sent": $body_bytes_sent, ' + '"remote_addr": "$remote_addr", ' + '"remote_user": "$remote_user", ' + '"http_referrer": "$http_referer", ' + '"http_x_forwarded_for": "$http_x_forwarded_for", ' + '"http_user_agent": "$http_user_agent", ' + '"host": "$host", ' + '"uri": "$uri", ' + '"http_cf_connecting_ip": "$http_cf_connecting_ip", ' + '"http_cf_ray": "$http_cf_ray", ' + '"http_cf_ipcountry": "$http_cf_ipcountry", ' + '"scheme": "$scheme", ' + '"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/sites/*; + include /data/nginx/config/*; + include /data/nginx/sites/*; } + diff --git a/lint.sh b/lint.sh new file mode 100755 index 0000000..5c5d34f --- /dev/null +++ b/lint.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +ruff check --fix . +ruff format . + +# https://github.com/soulteary/nginx-formatter +nginx-formatter diff --git a/scripts/http_host/nginx_site.conf b/scripts/http_host/nginx_site.conf index bc96d4f..480cfa2 100644 --- a/scripts/http_host/nginx_site.conf +++ b/scripts/http_host/nginx_site.conf @@ -1,17 +1,27 @@ 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 off; - error_log /data/ofm/logs/nginx-error.log; + #access_log /data/ofm/logs/nginx-access.log access_json; + access_log off; + error_log /data/ofm/logs/nginx-error.log; - location /planet/20231208_091355 { - gzip off; + location /planet/20231208_091355 { + gzip off; - alias /data/ofm/runs/planet_20231208_091355/mnt_rw/extract; - autoindex on; # Enables listing of directory - } -} + alias /data/ofm/runs/planet_20231208_091355/mnt_rw/extract; + autoindex on; # Enables listing of directory + } + + location / { + try_files $uri $uri/ @empty; + } + + location @empty { + default_type text/plain; # TODO + return 200 "''"; + } + +} \ No newline at end of file