How to set server_tokens=off using docker-compose with nginx

I have setup seafile-pro V7.0 with docker-compose using https with Letsencrypt.
I used the suggested docker-compose.yml referenced by the manual

To increase security I would like to set
server_tokens off;
in the nginx-config.This is also mentioned in the manual at Enabling Https with Nginx

The Problem:
The nginx configfile gets autogenerated by the used docker image.

Is there a way to define config options for nginx that can be set in the docker-compose file?

  • I don’t want to create my own dockerfile if possible for easier upgrades :slight_smile:


You can try to specify a persistent path for nginx in your docker .yml file and create your own config.

    image: seafileltd/seafile-mc:latest
      - ""
      - /opt/seafile-nginx:/etc/nginx/sites-enabled
      - /opt/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.

Thanks for your reply.

Sorry I took so long to test it …

I have created a new nginx config (copied the original one out of docker + added server_tokens=off) and passed the volume as you described. After a restart of docker-compose however, it seems to not have worked since it still shows the server version.
I did a docker-compose restart. Is this enough, or do I need to do a full stop and then start it up again?

Also the nginx config file gets automatically generated by the docker-image. I have named the newly created file exactly as the generated one. Do I have to consider other steps too?

Thanks for your help.

Best regards