A particularly convenient option is to use a dockerized Nginx reverse proxy with automated Let’s Encrypt certificate generation. This is achieved with this docker-compose.yml. (The nginx_proxy.conf needs to be stored in the same directory to allow uploading large media files to Gramps Web.)
Please provide more information about your configuration.
Narrative Web puts everything in the directory your designated. It is made of a base directory <tree_name>_NAVWEB containing images and img subdirectories. As long as nGinx has access to the base directory, you should be able to display your images. Of course, the drawback is duplication of media files from where they are normally stored into the NAVWEB directory.
Here is a part of my nGinx configuration (it hosts several servers, I just display the NavWeb one) which is entered with URL //localhost/Famille. Sensitive data have been replaced by …
location ^~ /Famille {
if ($scheme != 'https') { # see note 1
return 403;
}
location ~ \.html$ {
root /home/…/www/saga_NAVWEB;
fastcgi_split_path_info ^(/Famille)(/.*|$);
# include fastcgi.conf;
# see note 2 why this directive is commented out and replaced by its expansion
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param SCRIPT_NAME poc.pl;
fastcgi_param SCRIPT_FILENAME /home/…/projects/Saga_data_filtering/poc.pl;
# see note 3
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_read_timeout 10s;
fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap-0.sock;
}
location = /Famille/au.th {
# see note 4
root /home/…/www/saga_NAVWEB;
fastcgi_split_path_info ^(/Famille/au\.th)(/.*|$);
# include fastcgi.conf;
# see again note 2
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param SCRIPT_NAME poc.pl;
fastcgi_param SCRIPT_FILENAME /home/prog/projects/Saga_data_filtering/poc.pl;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap-0.sock;
}
location ~ /Famille(/.*(?!\.html(\?|$))) {
# see note 5
alias /home/…/www/saga_NAVWEB$1;
}
}
location ^~ /WEBCAL/ {
if ($scheme != 'https') {
return 403;
}
rewrite /WEBCAL(.*) /saga_WEBCAL$1 last;
}
location ^~ /saga_WEBCAL/ {
if ($scheme != 'https') {
return 403;
}
root /home/…/www;
}
location ^~ /images/ {}
location ^~ /common/ {}
rewrite /NAVWEB/(.*) /Famille/$1 last;
Notes:
As a weak protection, I only allow HTTPS access to my Gramps server. Since I create myself the keys, my self-signed site is considered as “suspect” by most browsers and this requires special manipulation to complete access.
Using standard include fastcgi.conf results in a conflict in assigning values to SCRIPT_NAME and SCRIPT_FILENAME leading to HTML Error 400. I preferred to assign all variables with the values I expect.
I don’t serve directly the Gramps pages. I filter them through Perl script poc.pl (proof-ot-concept). I have expended the notion of “private data” from a binary yes-no to a versatile “tagging” system. A Gramps object can be annotated with a string of sequences (say words to simplify matters) separated by spaces. This propagates to the pages generated by NavWeb in the <head> part of the HTML page. When such a page is detected by script poc.pl, its transmission is suspended and user is requested to authenticate. If successful, the page is transmitted, otherwise an error page is displayed.
This is the response to the authentication request. It is managed as a small finite state automaton
This section is for all non-HTML data: CSS, images, … It must not be filtered or altered in any way
The rest of the directives are there because I didn’t change the URL structure when I changes from Apache to nGinx (many years ago) and didn’t changer either the parameters in the Narrative Web control dialog. I should do it to make the URLs more consitent and simplify nGinx configuration.
Hi and thanks for the reply. I am guessing that this has to be integrated to, or be saved in the same folder as the default.conf file but that’s only a guess.
Using the default installation instructions, it’s unclear.
You didn’t mention your Linux distro. There are various existing structuring for configuration file storage.
I’m under Fedora 37. There is an /etc/nginx/default.d/ directory and I don’t tamper with it. After all, it sets default parameters supposedly valid in any circumstances. There are also /etc/nginx.nginx.conf and /etc/nginx.nginx.conf.default which define catch-all fall-back configuration in case a user’s one fails. I don’t tamper with them either.
I create a mysite.conf file to be stored into /etc/nginx/conf.d from which it will be automatically extracted and interpreted when nginx is started. Its contents is a complete server {} block, out of which one or more location describe my Narrative Web pages.
My sanity rule is to never interfere with default configuration which is usually intended for graceful fallback. It is better to store in the adequate directory an overriding configuration file.
I am not familiar at all with docker configurations.
nGinx met an unexpected condition when it wanted to read some contents. The 21 may be the line number in my_proxy.conf where the error occurs. What is the directive there? Your workaround consists in restricting what nGinx includes to the two file in your interest. Works but it might be interesting to know why it fails in the general case.
You say you describe your Gramps environment in yml. There may be some error during the translation. It is certainly better to track back the cause to your yml source.
I appreciate it your efforts to troubleshoot. I am far from a docker wizard.
21 is an error code.
The error is that my_proxy.conf should have been created in the file system with files inside it before the image was deployed, but that’s not possible for someone like me who is not ssh’d into the underlying file system.
I was able to resolve this situation by removing /my_proxy.conf from the originally posted yaml file. This unlocked the directory and allowed me to remove it. The generated file then referenced /etc/nginx/conf.d/* which contained a default.conf file which was correctly imported and resolved the issue.