Add troubleshooting/nginx-port-80-conflict.md
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
# Nginx Port 80 Conflict
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
Docker nginx container would not start.
|
||||||
|
|
||||||
|
### Error
|
||||||
|
|
||||||
|
```bash
|
||||||
|
failed to bind host port 0.0.0.0:80
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cause
|
||||||
|
|
||||||
|
Ubuntu nginx service was already using port 80.
|
||||||
|
|
||||||
|
## Fix
|
||||||
|
|
||||||
|
Check what is using port 80:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ss -tulpn | grep :80
|
||||||
|
```
|
||||||
|
|
||||||
|
Stop nginx:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl stop nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
Disable nginx:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl disable nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
Remove nginx:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt remove nginx nginx-common -y
|
||||||
|
```
|
||||||
|
|
||||||
|
Try the Docker container again.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name nginx -p 80:80 nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
## Result
|
||||||
|
|
||||||
|
The Docker nginx container started successfully and was able to bind to port 80.
|
||||||
Reference in New Issue
Block a user