Nginx failed to restart after ssl configuration for HTTPS

httpsnginxssl

I wanted to serve my website over https and thus I followed this tutorial exactly as given.

On step 5 sudo nginx -t gave positive results as configuration was OK. When I ran sudo systemctl restart nginx it gave the following error

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

When I checked the error logs at /var/log/nginx/error.log if showed this error

2017/03/14 07:35:20 [emerg] 12111#12111: bind() to 0.0.0.0:443 failed (98: Address already in use)

2017/03/14 07:35:20 [emerg] 12111#12111: bind() to 0.0.0.0:443 failed (98: Address already in use)

2017/03/14 07:35:20 [emerg] 12111#12111: bind() to 0.0.0.0:443 failed (98: Address already in use)

2017/03/14 07:35:20 [emerg] 12111#12111: bind() to 0.0.0.0:443 failed (98: Address already in use)

2017/03/14 07:35:20 [emerg] 12111#12111: bind() to 0.0.0.0:443 failed (98: Address already in use)

2017/03/14 07:35:20 [emerg] 12111#12111: still could not bind()

After tried with tricks like including ipv6only=on, apparently nothing seemed to work and now I am clueless what to do?

My default configuration is available here

Please help

Best Answer

that looks as if another process opened port tcp/443 and nginx fails to do so because of this. did you check netstat for an already opened port 443?