Error - Could not bind TCP port 80 because it is already in use by another process on this system (such as a web server)
This is the fourteenth in a series of posts featuring Protips, tips, tricks, hacks, and secrets provided by Our Team 🙊 — We want to share our top tips for the growing and thriving Linux community out there. Because sometimes you need a little help...
Let's Encrypt is a terrific new free service that allows users to obtain a free SSL certificate to secure their website. Those free certificates only last a few months and must be updated on a regular basis.
You might be running into this error about not being able to renew Let's Encrypt certificates after issuing this command below.
sudo certbot renew -d your.website.com
OUTPUT:
Failed to renew certificate your.website.com with error:
Could not bind TCP port 80 because it is already in use by
another process on this system (such as a web server).
Please stop the program in question and then try again.
What we need to do here is stop
and start
all the web server applications you might have running.
ie. Apache HTTP Server, Nginx, Lighttpd, OpenLiteSpeed... you name it.
$ sudo systemctl stop nginx
$ sudo systemctl restart nginx
then check each for their status;
$ sudo systemctl status nginx
OUTPUT
● nginx.service - A high performance web server and a reverse
proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled;
vendor preset: enabled)
Active: active (running) since Wed 2023-11-22 16:24:51 UTC;
12s agoDocs: man:nginx(8)
Process: 1291303 ExecStartPre=/usr/sbin/nginx -t -q -g daemon
on; master_process on; (code=exited, status=0/SUCCESS)
Process: 1291316 ExecStart=/usr/sbin/nginx -g daemon on;
master_process on; (code=exited, status=0/SUCCESS)
Main PID: 1291318 (nginx)
Tasks: 7 (limit: 2100)
Memory: 16.7M
CPU: 614ms
CGroup: /system.slice/nginx.service
.....
....
..
.
now run;
$ sudo certbot renew -d your.website.com
OUTPUT
Renewing an existing certificate
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
.....
...
..
.
And voila!