解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
来源:互联网 发布:印度崛起 知乎 编辑:程序博客网 时间:2024/05/19 01:10
首选是安装nginx,在./configure出错的情况下,查看错误的报告,如果是缺少一些必要的库,安装这些库,可能的有ssl pcre(这个库我是使用源码安装的,在线安装没有成功,提示看不到这个库)等 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 这个是这个库的连接。下载源码然后安装即可!
然后make
make install
如果使用的是源码安装,安装后的目录在/usr/local/nginx.其中有所有的东西,源码安装的启动方式:sbin/nginx,这个程序在/usr/local/nginx
如果是在线安装,安装后的缺省目录在/etc/init.d/nginx start
如果在安装过程在浏览器中查找尝试!!
在ubuntu10.04上面安装nginx,安装完成之后尝试启动nginx,使用命令:
sudo
/etc/init
.d
/nginx
start
结果提示错误:
hankcs@ubuntu:~$
sudo
/etc/init
.d
/nginx
start
[
sudo
] password
for
hankcs:
* Starting nginx nginx nginx: [emerg] bind() to [::]:80 failed (98: Address already
in
use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already
in
use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already
in
use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already
in
use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already
in
use)
nginx: [emerg] still could not bind()
我看了一下端口占用情况,并且尝试杀了进程:
hankcs@ubuntu:~$
netstat
-ntpl
(并非所有进程都能被检测到,所有非本用户的进程信息将不会显示,如果想看到所有信息,则必须切换到 root 用户)
激活Internet连接 (仅服务器)
Proto Recv-Q Send-Q Local Address Foreign Address State PID
/Program
name
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
hankcs@ubuntu:~$ killall -9 nginx
nginx:没有发现操作
遇到这种问题我先用中文搜索了一下答案,发现大家都在装逼地说要杀nginx重复的进程。我试了下发现是扯淡,于是看了谷歌搜到的第一个英文页面,老外说是nginx先监听了ipv4的80端口之后又监听了ipv6的80端口,于是就重复占用了。更加坑人的是你去看了端口占用它又把80端口释放了,是不是很囧。
解决方案是编辑nginx的配置文件
hankcs@ubuntu:~$
sudo
gedit
/etc/nginx/sites-available/default
修改这一段:
listen 80;
listen [::]:80 default_server;
为
listen 80;
listen [::]:80 ipv6only=on default_server;
然后启动nginx,完美解决!
还有一种可能的情况就是,如果你是在虚拟机中安装了nginx,那么在虚拟机中的firefox可能就是不能连接,但是在宿主机中的浏览器可以连接(前提是宿主机和虚拟机是可以相通的!!!)
1 0
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 错误解决
- 解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 错误解决
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 错误解决
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)问题的解决
- 解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
- 解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
- nginx错误之 nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
- Nginx [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
- Nginx [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
- Nginx [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
- nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
- Nginx [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
- 关于nginx启动失败 [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
- Nginx [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
- nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 解决办法
- hdu2196 Computers 树形DP
- UIResponder类的介绍
- Unity3 游戏优化 - 缓存(重复利用)物体
- AOJ - 0005 GCD and LCM (O(logn)求最大公约数,最小公倍数)
- Path Sum
- 解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
- Github for windows 安装教程(历尽千辛终于可以安装了)
- 通过web安装iOS app
- 关于数据结构的详细介绍,自己总结的 ,勿喷。谢谢
- linux下串口gps应用
- Linux操作系统文件系统基础知识详解
- 文件加结构体
- GCC下用C写for循环延迟函数并且不被优化的实现
- Source Insight工程中tab键显示乱码解决方法