From 039aa155a6dcf5bc8771c5e4a15ef107dceaa344 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Tue, 9 Apr 2024 14:37:15 +0000 Subject: [PATCH] Enable cgimap --- compose/web.yml | 1 + images/web/config/production.conf | 36 ++++++++++++------------------- images/web/start.sh | 18 ++++++++-------- 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/compose/web.yml b/compose/web.yml index cc6bbf10..15387c2e 100644 --- a/compose/web.yml +++ b/compose/web.yml @@ -23,6 +23,7 @@ services: dockerfile: Dockerfile ports: - '80:80' + - '8080:8080' env_file: - ../envs/.env.web - ../envs/.env.db diff --git a/images/web/config/production.conf b/images/web/config/production.conf index 37c2cfc8..52ff53f5 100644 --- a/images/web/config/production.conf +++ b/images/web/config/production.conf @@ -8,8 +8,8 @@ # Development mode in case domain is localhost # ======Redirect to HTTPS - RewriteCond %{HTTP_HOST} !=localhost - RewriteCond %{HTTP_HOST} !=127.0.0.1 + # RewriteCond %{HTTP_HOST} !=localhost + # RewriteCond %{HTTP_HOST} !=127.0.0.1 # RewriteCond %{HTTPS} off # RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] @@ -18,28 +18,20 @@ # RewriteCond %{HTTP_HOST} !^www\. [NC] # RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] - # - # # For TM, do not use cgimap auth. - # - # CGIPassAuth On - # - # + + CGIPassAuth On + # ======Proxying traffic to CGImap==== - # RewriteCond %{REQUEST_URI} ^/api/0\.6/map - # RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] - # RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ - # RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] - # RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] - # RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] - # RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] - # RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] - # RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] - - # For changeset requests originating from TM, do not use cgimap. - # RewriteCond %{REQUEST_METHOD} ^POST$ - # RewriteCond %{HTTP_REFERER} !^https://tasks(-\w+)?\.osmseed\.org/ [NC] - # RewriteRule ^/api/0\.6/changeset/[0-9]+/(upload|download)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] + RewriteCond %{REQUEST_URI} ^/api/0\.6/map + RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] + RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ + RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] + RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] + RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] + RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] + RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] + RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P] # Relax Apache security settings diff --git a/images/web/start.sh b/images/web/start.sh index a852a194..e42dcaf0 100755 --- a/images/web/start.sh +++ b/images/web/start.sh @@ -72,15 +72,15 @@ while "$flag" = true; do done & # time rails i18n:js:export assets:precompile bundle exec rails db:migrate - # /usr/local/bin/openstreetmap-cgimap \ - # --port=8000 \ - # --daemon \ - # --instances=10 \ - # --dbname=$POSTGRES_DB \ - # --host=$POSTGRES_HOST \ - # --username=$POSTGRES_USER \ - # --password=$POSTGRES_PASSWORD \ - # --logfile log/cgimap.log + /usr/local/bin/openstreetmap-cgimap \ + --port=8000 \ + --daemon \ + --instances=10 \ + --dbname=$POSTGRES_DB \ + --host=$POSTGRES_HOST \ + --username=$POSTGRES_USER \ + --password=$POSTGRES_PASSWORD \ + --logfile log/cgimap.log bundle exec rake jobs:work & apachectl -k start -DFOREGROUND done