网站首页 > 技术教程 正文
我用的虚拟机是VM,Linux版本是CentOS6.3。在安装完Nginx之后,准备启动Nginx服务。
切到目录:
[root@localhost ~]# cd /usr/local/nginx/sbin
[root@localhost sbin]# ./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 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
,Nginx服务使用80端口,看报错信息大概就是80端口已经被占用。
既然80端口已经被占用,那我们就来看看是什么占用了80端口。
[root@localhost ~]# netstat -ntlp|grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1468/nginx
看结果,是Nginx进程占用的。那我们就杀死Nginx进程再启动Nginx服务。
首先查看与Nginx有关的进程。据我观察,前四个是Nginx有关的进程,这四个进程要全部杀死,才能启用Nginx。第四个进程是我们抓取Nginx的进程没有关系。
[root@localhost sbin]# ps -ef |grep nginx
www 2479 1 0 12:46 00:00:00 nginx: worker process
www 2480 1 0 12:46 00:00:00 nginx: worker process
www 2483 1 0 12:46 00:00:00 nginx: worker process
www 2485 1 0 12:46 00:00:00 nginx: worker process
root 2491 2405 0 12:47 pts/0 00:00:00 grep nginx
然后我们执行命令:
[root@localhost sbin]# kill -9 2479
[root@localhost sbin]# kill -9 2480
[root@localhost sbin]# kill -9 2483
[root@localhost sbin]# kill -9 2485
查看杀死Nginx1进程后的结果:
[root@localhost sbin]# ps -ef |grep nginx
root 2495 2405 0 12:48 pts/0 00:00:00 grep nginx
这时候我们再次开启Nginx服务:
[root@localhost sbin]# ./nginx
[root@localhost sbin]#
这时候成功了!!!!!!
这个过程中要注意的是:与Nginx有关的进程要全部杀死!!我之前没有全部杀死,导致一直有Nginx进程存在,启用Nginx服务就一直报错。
猜你喜欢
- 2024-10-12 「技术架构」使用NGINX部署Spring Boot
- 2024-10-12 什么是Nginx惊群问题?如何解决它?
- 2024-10-12 安装Nginx并启用stream模块(nginx安装使用)
- 2024-10-12 使用Docker安装并启动nginx(docker 安装 nginx)
- 2024-10-12 「nginx」 nginx运行异常 启动失败问题解决
- 2024-10-12 Nginx启动时框架的处理流程(总结精辟)
- 2024-10-12 Centos7启动流程及Systemd中Nginx启动配置
- 2024-10-12 nginx&redis&jar文件开机自启动
- 2024-10-12 Nginx的配置系统启动运行(nginx启动方式)
- 2024-10-12 Linux新手入门系列:注册systemctl服务,设置nginx开启自启动
你 发表评论:
欢迎- 最近发表
-
- Win10 TH2正式版官方ESD映像转换ISO镜像方法详解
- 使用iso镜像升级到Windows 10的步骤
- macOS Ventura 13.2 (22D49) Boot ISO 原版可引导镜像
- 安利一个用ISO镜像文件制作引导U盘的的小工具RUFUS
- CentOS 7使用ISO镜像配置本地yum源
- 用于x86平台的安卓9.0 ISO镜像发布下载:通吃I/A/N、完全免费
- AlmaLinux 9.6发布:升级工具、初步支持IBM Power虚拟化技术
- Rufus写入工具简洁介绍与教程(写入模式)
- 新硬件也能安装使用了,Edge版Linux Mint 21.3镜像发布
- 开源工程师:Ubuntu应该抛弃32位ISO镜像
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)