Report this

What is the reason for this report?

I encounter error when service nginx reload

Posted on October 15, 2021

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Thank you very much for the help

Its all work fine now

Hello,

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.

Best, Bobby

Thank you very much for the help. I want to ask, if i want to ask the droplet ip to the other domain, may i ask, how i can do that?

I try to set it:

server { listen 80 default_server; server_name _; return 301 https://$host$request_uri; }

server { listen 80 default_server; server_name 165.22.109.176; return 301 https://abc.com; }

server {

listen 80 default_server;

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;

    # Make site accessible from http://localhost/
    server_name localhost;

    proxy_set_header        X-Real-IP       $remote_addr;
    proxy_set_header        X-Forwarded-For 
    $proxy_add_x_forwarded_for;

location / { proxy_pass https://agmpo555.com; proxy_ssl_server_name on; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. #try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/html;
    }

    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.0-fpm.sock;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #       deny all;
    #}

}

but when it does not want to redirect the IP. Thank you very much

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.