0

I have been trying to configure my nginx reverse proxy but I keep getting this error

nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/sites-enabled/mattermost:20
nginx: [warn] conflicting server name "chat.sam.dev" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "chat.sam.dev" on 0.0.0.0:443, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

This is my configuration file

upstream backend {
   server localhost:8065;
   keepalive 32;
}

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;

server {
  listen 80;
  server_name   chat.ignite.dev;
  return 301 https://$server_name$request_uri;
}

This part is for https. I want to redirect every request to https

server {
   listen 443 ssl http2;
   server_name    chat.ignite.dev;

   http2_push_preload on; # Enable HTTP/2 Server Push

   ssl on;
   ssl_certificate /etc/letsencrypt/live/chat.ignite.dev/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/chat.ignite.dev/privkey.pem;
   ssl_session_timeout 1d;

   # Enable TLS versions (TLSv1.3 is required upcoming HTTP/3 QUIC).
   ssl_protocols TLSv1.2 TLSv1.3;

   # Enable TLSv1.3's 0-RTT. Use $ssl_early_data when reverse proxying to
   # prevent replay attacks.
   #
   # @see: https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_early_data
   ssl_early_data on;

   ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
   ssl_prefer_server_ciphers on;
   ssl_session_cache shared:SSL:50m;
   # HSTS (ngx_http_headers_module is required) (15768000 seconds = six months)
   add_header Strict-Transport-Security max-age=15768000;
   # OCSP Stapling ---
   # fetch OCSP records from URL in ssl_certificate and cache them
   ssl_stapling on;
   ssl_stapling_verify on;

   add_header X-Early-Data $tls1_3_early_data;

}

I don't know why it is conflicting

etranz
  • 891
  • 2
  • 10
  • 29
  • 1
    Please provide your configuration files for nginx. – Geilmaker Jul 24 '23 at 18:54
  • Use `nginx -T` (uppercase `T`) to view the entire configuration across all included files. You should be able to identify the source of the conflicting `server` blocks. Also, you do not need the `ssl on;` statement - it is deprecated. – Richard Smith Jul 25 '23 at 07:47

0 Answers0