I made Nginx configuration. I got error message after this command: sudo nginx -t && sudo systemctl reload nginx
Error Message:

nginx: [emerg] "server_tokens" directive is duplicate in /etc/nginx/conf.d/dokku.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed

dokku.conf:

server_tokens off;

# Settings from https://mozilla.github.io/server-side-tls/ssl-config-generator/
ssl_session_cache   shared:SSL:20m;
ssl_session_timeout 1d;
ssl_session_tickets off;

ssl_dhparam /etc/nginx/dhparam.pem;
ssl_ciphers ECDHE-ECDSA-AE.......

nginx.conf:

# Generated by nginxconfig.io
# https://www.digitalocean.com/community/tools/nginx?domains.0.server.domain=vo$

user                 www-data;
pid                  /run/nginx.pid;
worker_processes     auto;
worker_rlimit_nofile 65535;

events {
    multi_accept       on;
    worker_connections 65535;
}

http {
    charset              utf-8;
    sendfile             on;
    tcp_nopush           on;
    tcp_nodelay          on;
    server_tokens        off;
     log_not_found        off;
    types_hash_max_size  2048;
    client_max_body_size 16M;

    # MIME
    include              mime.types;
    default_type         application/octet-stream;

    # Logging
    access_log           /var/log/nginx/access.log;
    error_log            /var/log/nginx/error.log warn;

    # SSL
    ssl_session_timeout  1d;
    ssl_session_cache    shared:SSL:10m;
    ssl_session_tickets  off;

    # Diffie-Hellman parameter for DHE ciphersuites
    ssl_dhparam          /etc/nginx/dhparam.pem;
     ssl_protocols        TLSv1.2 TLSv1.3;
    ssl_ciphers          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA$

    # OCSP Stapling
    ssl_stapling         on;
    ssl_stapling_verify  on;
    resolver             1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 208.67.222.222 208.67.$
    resolver_timeout     2s;

    # Load configs
    include              /etc/nginx/conf.d/*.conf;
    include              /etc/nginx/sites-enabled/*;
}

How can I fix this problem?
Thanks.

edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hi there @mervecse,

It seems like that you have the server_tokens defined in both your dokku.conf and nginx.conf.

What you could do is just remove the server_tokens line from your dokku.conf file as you already have it defined for the http directive in your main Nginx config file.

Let me know how it goes!
Regards,
Bobby

I’ve removed servertokens and gave error for dublicate sslsessioncache. Then, I’ve removed all duplicate data. But I still have error.
nginx: [emerg] BIO
newfile(“/etc/letsencrypt/live/ergidatarim.com.tr/fullchain.pem”) failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(’/etc/letsencrypt/live/ergidatarim.com.tr/fullchain.pem’,‘r’) error:2006D080:BIO routines:BIOnew_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

Submit an Answer