I encounter error when service nginx reload

Posted October 15, 2021 189 views

i am trying to implement an SSL to the IP but i encounter an error when i run service nginx reload

Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xe” for details.

and then when i run, sudo nginx -t

nginx: [warn] the “ssl” directive is deprecated, use the “listen … ssl” directive instead in /etc/nginx/sites-enabled/digitalocean:33

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.

Submit an Answer
2 answers


In order to fix the warning you need to open the /etc/nginx/sites-enabled/digitalocean file, and change the following:

  • Find this line:

    listen 443;
  • And change it to:

listen 443 ssl;

Then on line 333 comment out the ssl on; line by adding a # before it as follows:

# ssl on;

Or delete the line completely.

Before making any changes, make sure to backup your config in case that you need to rever back to the previous version of the config file.

Also if Nginx is still not starting, make sure to check he Nginx error log:

tail -100 /var/log/nginx/error.log

Feel free to share the log here.


  • Thank you for the reply and the help, i have change according to your guide, here are the current lines

    server {
    listen 80 defaultserver;
    name ;
    return 301 https://$host$request

    server {
    #listen 80 defaultserver;
    #listen [::]:80 default
    server ipv6only-on;

        listen 443 ssl;
        listen [::]:443 ssl default_server;
        #ssl    on;
        ssl_certificate /etc/nginx/certificate.crt;
        ssl_certificate_key     /etc/nginx/private.key;
        root /var/www/html;
        index index.php index.html index.htm;

    when i try to reload it still say that inginx.service is not active, can not reload

    and when i enter tail -100 /var/log/nginx/error.log, it does not reply with anything

    Thank you

    • When i run : systemctl status nginx.service, i got this error message

      ● nginx.service - A high performance web server and a reverse proxy server
      Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
      Active: failed (Result: exit-code) since Mon 2021-10-18 13:12:07 UTC; 15s ago
      Docs: man:nginx(8)
      Process: 73733 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FA>

      and when i run : journalctl -xe

      No journal files were found.

      Thank you

      • Hello,

        What I could suggest is checking the syntax of your configuration again:

        sudo nginx -t

        And also you now see any errors in the error log?

        sudo tail -100 /var/log/nginx/error.log
        • When i run : sudo nginx -t , this is the reply

          nginx: [emerg] unknown “request_url” variable
          nginx: configuration file /etc/nginx/nginx.conf test failed

          and when i check for the error, using sudo tail -100 /var/log/nginx/error.log , here is the error that i got

          2021/10/19 03:32:03 [emerg] 81032#81032: unknown “request_url” variable