解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
来源:互联网 发布:ps cs6 for mac 英文 编辑:程序博客网 时间:2024/06/05 11:27
首选是安装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可能就是不能连接,但是在宿主机中的浏览器可以连接(前提是宿主机和虚拟机是可以相通的!!!)
- 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) 解决办法
- Android NDK的初步认识(Android Studio 2.2 + CMake)
- Hrbust 2222 应援团补完计划【并查集+思维】好题~
- Spring4.x整合Quartz2.x动态修改定时器时间(修正多定时器SpringBean异常)
- tomcat——容器
- iOS开发NSNotification(通知)的正向传值
- 解决nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
- Android开发模式之MVC,MVP和MVVM的简单介绍与区别
- hdu2059(简单DP)
- CSU 1262——安全密码
- Linux下的静态库与动态库
- MyBatis Generator generatorConfig.xml配置详解
- Java_反射(reflect)
- 《浅谈架构之路:前后端分离模式》
- task_struct结构体详解