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:
# nginx -t
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/movies.domain.com:1
nginx: configuration file /etc/nginx/nginx.conf test failed
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):
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;
}
}
The full contents of /etc/nginx/include.d/proxy_settings.conf are as follows:
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;
I have seen this question, and this answer, in which both are missing the certificates, and give the correct line in the file.
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.
Am I missing something here?