From 5a9fb9328a700f563bdcb9e95cbd8073953c7da0 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 18 Oct 2018 18:05:17 +0200 Subject: [PATCH] Add a conditional section for the uri-resolver. --- .../generic-smartgears-virtualhost.j2 | 59 +++++++++++++++---- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 index a1675202..191777bd 100644 --- a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 +++ b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 @@ -126,6 +126,15 @@ server { proxy_pass http://{{ remote_opencpu_host }}:{{ opencpu_proxy_port | default('8004') }}{{ opencpu_context | default('/ocpu') }}; } {% endif %} + + {% if smartgears_nginx_expose_tomcat_logs %} + location /gcube-logs/ { + alias {{ smartgears_instance_path }}/logs/; + autoindex on; + autoindex_localtime on; + } + {% endif %} + {% if rstudio_install_server is defined and rstudio_install_server %} location / { {% if smartgears_nginx_cors_enabled %} @@ -135,12 +144,20 @@ server { } {% endif %} - {% if smartgears_nginx_expose_tomcat_logs %} - location /gcube-logs/ { - alias {{ smartgears_instance_path }}/logs/; - autoindex on; - autoindex_localtime on; - } + {% if smartgears_uri_resolver_install is defined and smartgears_uri_resolver_install %} + location /geonetwork { + {% for ip in ckan_ip_list %} + allow {{ ip }}; + {% endfor %} + deny all; + } + + location / { + {% if smartgears_nginx_cors_enabled %} + include /etc/nginx/snippets/nginx-cors.conf; + {% endif %} + proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/uri-resolver/; + } {% endif %} {% else %} @@ -278,6 +295,15 @@ server { proxy_pass http://{{ remote_opencpu_host }}:{{ opencpu_proxy_port | default('8004') }}{{ opencpu_context | default('/ocpu') }}; } {% endif %} + + {% if smartgears_nginx_expose_tomcat_logs %} + location /gcube-logs/ { + alias {{ smartgears_instance_path }}/logs/; + autoindex on; + autoindex_localtime on; + } + {% endif %} + {% if rstudio_install_server is defined and rstudio_install_server %} location / { {% if smartgears_nginx_cors_enabled %} @@ -287,12 +313,21 @@ server { } {% endif %} - {% if smartgears_nginx_expose_tomcat_logs %} - location /gcube-logs/ { - alias {{ smartgears_instance_path }}/logs/; - autoindex on; - autoindex_localtime on; - } + {% if smartgears_uri_resolver_install is defined and smartgears_uri_resolver_install %} + location /geonetwork { + {% for ip in ckan_ip_list %} + allow {{ ip }}; + {% endfor %} + deny all; + } + + location / { + {% if smartgears_nginx_cors_enabled %} + include /etc/nginx/snippets/nginx-cors.conf; + {% endif %} + proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/uri-resolver/; + } {% endif %} + } {% endif %}