I was using a dev environment with Windows and WSL with docker and nginx installed directly in my WSL machine to handle the proxy reverse, but now when I'm trying to start nginx, I'm getting the error "98: Unknown error" and using the command "sudo nginx -t", it shows me "bind() to 0.0.0.0:80 failed" and "0.0.0.0:443 failed", what can I do to fix this?
ubuntu wsl comes with apache web server pre-installed, its using the default web port (80), so when you try to start nginx with default setting (also on port 80) it will have bind error
but of-course, there are multiple reason that port 80 is already used, in which you need to check what app that is using it
sudo systemctl status apache2
localhost
in the address barthis solution is for when apache2 is the culprit, for any other app that might use port 80, you need to find how to disable it yourself
sudo systemctl stop apache2
sudo systemctl disable apache2
sudo systemctl start nginx
sudo systemctl enable nginx
of-course, you can just change the port used by nginx like here use other port on nginx
if you decide to change nginx port, please note that any host listening on port that is used by other app will make nginx fail to start, so if you have more than 1 host on nginx config, you need to update them too