Skip to content

Serving Static Files & Frontend with Nginx

Silvan Heller edited this page Aug 24, 2022 · 2 revisions

This page includes basic guidance on how to host your thumbnails & multimedia objects using nginx.

We assume your vitrivr-ng is deployed at /var/www/html.

Setup

  • Install nginx as described here
  • Start nginx sudo nginx
  • Modify your config-files at /etc/nginx/nginx.conf with the following content:
        server {
                listen 80 default_server;
                listen [::]:80 default_server;

                root /var/www/html;

                server_name _;

                index index.html;

                location ~ /\.ht {
                        deny all;
                }

                location / {
                        try_files $uri $uri/ /index.html;
                }

                location /V3C1/ {
                        root /tank/;
                        autoindex on;
                        sendfile on;
                        tcp_nopush on;
                }
        }
  • Replace /V3C1/ with the naming scheme of your media collection and /tank/ with the location of your thumbnails & media objects

  • Remove the two lines which include default-configs at the end

Leaflet Issues

In some deployments, leaflet does not request markers for the map at the correct location. In these cases, you can simply rewrite the urls in nginx:

rewrite ^(.*)"\)marker-icon.png $1 last;
rewrite ^(.*)"\)marker-shadow.png /marker-shadow.png last;
Clone this wiki locally