英文:
Nginx won't start
问题
I recently installed Nginx on Ubuntu, and I want to run it, so I use the nginx command, but I got this error.
root@kevin-virtual-machine:/etc/nginx# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] still could not bind()
root@kevin-virtual-machine:/etc/nginx#
I haven't done anything; I just installed it and it doesn't work.
I tried searching for the solution, but I haven't found one yet.
英文:
I recently installed Nginx on ubuntu, and I want to run it, so i use the nginx command, but I got this error.
root@kevin-virtual-machine:/etc/nginx# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] still could not bind()
root@kevin-virtual-machine:/etc/nginx#
Ii haven't done anything, I just installed it and it doesn't work.
I tried searching for the solution, but I haven't found one yet.
答案1
得分: 1
尝试这些命令:
sudo netstat -tuln | grep :80 # 这是用于查找相同端口上的冲突
重新启动 nginx:
sudo systemctl stop nginx
查找脚本中的错误:
sudo nginx -t
如果以上命令都不起作用,请尝试使用端口 8080 而不是端口 80。
英文:
Try these commands
sudo netstat -tuln | grep :80 # This is for finding confilicts in the same port
Restart nginx
sudo systemctl stop nginx
Find errors in the script :
sudo nginx -t
If none of them worked, try using port 8080 instead of port 80.
答案2
得分: 0
我通过终止Nginx进程来解决了这个问题。以下是我所做的:
- 获取每个Nginx进程的进程ID。
pgrep nginx
- 然后根据进程ID终止每个进程。
kill [进程ID]
- 然后重新启动nginx。
sudo service nginx restart
英文:
I solved it by killing the Nginx processes. Here is what I did:
- I get the process ID's of every Nginx process.
pgrep nginx
- Then I kill every process, given the process ID
kill [process id]
- Then I restarted nginx
sudo service nginx restart
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论