[nominatim-web] Switch to OpenResty



commit 53438b6e77109c899759aa8a76721fb5be8f0ab9
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Mon May 25 10:26:58 2020 +0200

    Switch to OpenResty

 Dockerfile |   4 +--
 nginx.conf | 104 ++++++++++++++++++++++++++++++++++++++-----------------------
 2 files changed, 67 insertions(+), 41 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index 46aba35..5289888 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,2 +1,2 @@
-FROM nginxinc/nginx-unprivileged:stable-alpine
-ADD nginx.conf /etc/nginx/conf.d/default.conf
+FROM openresty/openresty:1.15.8.3-2-buster
+ADD nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
diff --git a/nginx.conf b/nginx.conf
index c7fdc72..29d0901 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,53 +1,79 @@
-log_format cache '$remote_addr - $remote_user [$time_local] "$request" '
-                 '$status $body_bytes_sent "$http_referer" '
-                 '"$http_user_agent" "$http_x_forwarded_for" "$upstream_cache_status"';
+worker_processes  2;
 
-upstream nominatim {
-    server nominatim-int.gnome.org:80;
+error_log  /usr/local/openresty/nginx/logs/error.log warn;
+pid        /tmp/nginx.pid;
+
+events {
+    worker_connections  1024;
 }
 
-proxy_cache_path /var/cache/nginx/nominatim keys_zone=nominatim:100m
-                 levels=1:2 max_size=2g inactive=30d use_temp_path=off;
-proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
-proxy_cache_revalidate on;
-proxy_cache_background_update on;
-proxy_buffering on;
+http {
+    proxy_temp_path /tmp/proxy_temp;
+    client_body_temp_path /tmp/client_temp;
+    fastcgi_temp_path /tmp/fastcgi_temp;
+    uwsgi_temp_path /tmp/uwsgi_temp;
+    scgi_temp_path /tmp/scgi_temp;
 
-server {
-    listen 8080 default_server;
-    listen [::]:8080 default_server;
-    server_name  _;
+    default_type  application/json;
 
-    access_log  /var/log/nginx/access.log cache;
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for" "$upstream_cache_status"';
 
-    location / {
-       return 200;
-       access_log off;
-    }
+    access_log  /usr/local/openresty/nginx/logs/access.log  main;
 
-    if ($args ~* "accept-language\=([a-zA-z-]{1,5})") {
-        set $lang $1;
-    }
+    sendfile        on;
+    #tcp_nopush     on;
 
-    location = /search {
-       proxy_cache nominatim;
-       proxy_cache_key search$lang$arg_limit$arg_q$arg_country$arg_state$arg_city$arg_street;
-       proxy_cache_valid 200 30d;
-       proxy_cache_lock on;
+    keepalive_timeout  65;
 
-       proxy_pass http://nominatim/search;
-       proxy_set_header Host "nominatim-int.gnome.org";
-       add_header X-Cache-Status $upstream_cache_status;
+    #gzip  on;
+
+    upstream nominatim {
+       server nominatim-int.gnome.org:80;
     }
 
-    location = /reverse {
-       proxy_cache nominatim;
-       proxy_cache_key reverse$lang$arg_lon$arg_lat;
-       proxy_cache_valid 200 30d;
-       proxy_cache_lock on;
+    proxy_cache_path /tmp/nominatim keys_zone=nominatim:100m
+                   levels=1:2 max_size=2g inactive=30d use_temp_path=off;
+    proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
+    proxy_cache_revalidate on;
+    proxy_cache_background_update on;
+    proxy_buffering on;
+
+    server {
+       listen 8080 default_server;
+       listen [::]:8080 default_server;
+       server_name  _;
+
+       location / {
+           return 200;
+           access_log off;
+       }
+
+       if ($args ~* "accept-language\=([a-zA-z-]{1,5})") {
+           set $lang $1;
+       }
+
+       location = /search {
+           proxy_cache nominatim;
+           proxy_cache_key search$lang$arg_limit$arg_q$arg_country$arg_state$arg_city$arg_street;
+           proxy_cache_valid 200 30d;
+           proxy_cache_lock on;
+
+           proxy_pass http://nominatim/search;
+           proxy_set_header Host "nominatim-int.gnome.org";
+           add_header X-Cache-Status $upstream_cache_status;
+       }
+
+       location = /reverse {
+           proxy_cache nominatim;
+           proxy_cache_key reverse$lang$arg_lon$arg_lat;
+           proxy_cache_valid 200 30d;
+           proxy_cache_lock on;
 
-       proxy_pass http://nominatim/reverse;
-       proxy_set_header Host "nominatim-int.gnome.org";
-       add_header X-Cache-Status $upstream_cache_status;
+           proxy_pass http://nominatim/reverse;
+           proxy_set_header Host "nominatim-int.gnome.org";
+           add_header X-Cache-Status $upstream_cache_status;
+       }
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]