Solved: NGINX The “ssl” directive is deprecated, use the “listen … ssl”

nginx ssl on error

I have seen a lot of threads about this error, none of the solutions worked. Here is the solution.

nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/conf.d/vhosts/yourdomain.tld.ssl.conf:8

server {
listen xxx.yyy.zzz.vvv:443 ;
server_name ;
access_log /usr/local/apache/domlogs/ bytes;
access_log /usr/local/apache/domlogs/ combined;
error_log /usr/local/apache/domlogs/ error;

ssl on;
ssl_certificate /etc/pki/tls/certs/hostname.bundle;
ssl_certificate_key /etc/pki/tls/private/hostname.key;

Line 8 is –
ssl on;

The solution is simple.

Remove Line 8 (ssl on)

Modify Line 2 by adding “ssl” as marked in red:

listen xxx.yyy.zzz.vvv:443 ssl ;

Do this in all .ssl.conf files, as well as in the conf.d/hostname-ssl.conf file

Then restart the server and the error will be gone.

Bonus tip: Turning On HTTP/2

If you are already doing this, and your server is set up, you can turn on HTTP/2 at the same time and increase your site speed.

listen xxx.yyy.zzz.vvv:443 ssl http2 ;