title: nginx - no "ssl_certificate" is defined for the "listen ... ssl" directive at line 1
body: <p>I'm trying to configure my nginx reverse proxy using configs I've used as templates for ages.  For some reason, I'm now getting the following error:</p>
  <pre><code># nginx -t
  nginx: [emerg] no &quot;ssl_certificate&quot; is defined for the &quot;listen ... ssl&quot; directive in /etc/nginx/sites-enabled/movies.domain.com:1
  nginx: configuration file /etc/nginx/nginx.conf test failed
  </code></pre>
  <p>Note the oddity here:  It's reporting the listen directive is on line 1.  The contents of the file are below (note - I've output the entirety of the cat command so that you can see there is no whitespace at the top of the file):</p>
  <pre><code>root@spanners:/etc/nginx/sites-enabled# cat movies.domain.com 
  server {
      #Open 80 for the 301 Redirect
      listen 80;
      listen [::]:80;
  
      #This is the name of the server that we want to connect.
      server_name movies.domain.com;
  
      # The Actual Redirect itself
      return 301 https://movies.domain.com;
  }
  server {
      # The Actual Listening Port
      listen 443 ssl;
      listen [::]:443 ssl;
      server_name movies.domain.com;
      ssl_certificate           /etc/letsencrypt/live/domain.com/fullchain.pem;
      ssl_certificate_key       /etc/letsencrypt/live/domain.com/privkey.pem;
  
        location / {
  
        include /etc/nginx/include.d/proxy_settings.conf;
  
        proxy_pass    http://192.168.1.237:7878;
      }
  }
  </code></pre>
  <p>The full contents of /etc/nginx/include.d/proxy_settings.conf are as follows:</p>
  <pre><code>root@spanners:/etc/nginx/sites-enabled# cat ../include.d/proxy_settings.conf 
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
  
        proxy_read_timeout  90;
  </code></pre>
  <p>I have seen <a href="https://stackoverflow.com/questions/56668320/no-ssl-certificate-is-defined-for-the-listen-ssl-directive">this question</a>, and <a href="https://stackoverflow.com/questions/64856417/nginx-listen-ssl-directive-error-but-there-is-no-ssl-directive-set">this answer</a>, in which both are missing the certificates, and give the correct line in the file.</p>
  <p>There doesn't seem to be anything special here, but nginx is still reporting the listen...ssl on line 1.  For reference, IPv4 and IPv6 are enabled on this box, and while I realise the proxy pass is not forwarding to a IPv6 address, but that does not cause the same error on the other 11 config files in the same directory.</p>
  <p>Am I missing something here?</p>