nginx启动失败nginx: [emerg] bind() to 0.0.0.0:7001 failed (98: Address already in use)

news/2024/11/23 2:22:24/

./nginx 启动nginx,在启动时报错端口被占用

[root@localhost sbin]# ./nginx
nginx: [emerg] bind() to 0.0.0.0:7001 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:7001 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:7001 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:7001 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:7001 failed (98: Address already in use)

lsof -i:7001,查看被占用的进程

[root@localhost sbin]# lsof -i:7001
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    104324 root 1514u  IPv6 822256      0t0  TCP localhost.localdomain:afs3-callback (LISTEN)
java    104324 root 1515u  IPv6 811847      0t0  TCP localhost:afs3-callback (LISTEN)
java    104324 root 1516u  IPv6 810961      0t0  TCP localhost:afs3-callback (LISTEN)
java    104324 root 1517u  IPv6 810962      0t0  TCP localhost.localdomain:afs3-callback (LISTEN)
java    104324 root 1518u  IPv6 822257      0t0  TCP localhost.localdomain:afs3-callback (LISTEN)

解决办法:

方法一:如果涉及的进程不需要则将它杀死,杀死后./nginx重新启动nginx,80端口同理

[root@localhost nginx]# kill -9 7001[root@localhost sbin]# ./nginx

方法二:涉及进程需要,则修改端口

进入sbin目录下修改nginx.conf文件

修改前:

server {listen      7001;server_name  localhost;

修改后:

listen端口改为其他端口

server {listen      17001;server_name  localhost;

 ./nginx 重新启动nginx

[root@localhost sbin]# ./nginx

ps -ef | grep nginx查看进程:已启动

[root@localhost sbin]# ps -ef | grep nginx
root     106562      1  0 23:19 ?        00:00:00 nginx: master process ./nginx
nobody   106563 106562  0 23:19 ?        00:00:00 nginx: worker process
nobody   106564 106562  0 23:19 ?        00:00:00 nginx: worker process
root     106568 106205  0 23:19 pts/0    00:00:00 grep --color=auto nginx


http://www.ppmy.cn/news/307209.html

相关文章

七星配资次新股活跃

受大金融、煤炭走弱拖累,早盘沪指震荡,而受权重股影响,创业板指涨逾2%。此外,今日早盘科创板次新表现抢眼,科创50指数涨2.18%。截至午间收盘,沪指跌0.05%,报收3605点;深成指涨0.98%&…

7-1 拯救007

7-1 拯救007 分数 25 在老电影“007之生死关头”(Live and Let Die)中有一个情节,007被毒贩抓到一个鳄鱼池中心的小岛上,他用了一种极为大胆的方法逃脱 —— 直接踩着池子里一系列鳄鱼的大脑袋跳上岸去!(据…

7805(一)

7805三端稳压 集成电路,电子产品中,常见的三端稳压集成电路有正电压输出的78 系列和负电压输出的79系列。顾名思义,三端IC是指这种稳压用的集成电路,只有三条引脚输出,分别是输入端、接地端和输出端。它的样子像是普通…

day712

java java类加载流程 Bootstrap ClassLoader 最顶层的加载类,主要加载核心类库,Extention ClassLoader 扩展的类加载器Appclass Loader也称为SystemAppClass 加载当前应用的classpath的所有类。 加载顺序 Bootstrap ClassLoader (虚拟机的…

weblogic的默认端口是7001

weblogic的默认端口是7001&#xff0c;在config.xml文件中的添加 <listen-port>7008</listen-port> 位置如下&#xff1a; <server> <name>AdminServer</name> <listen-port>7008</listen-port> <listen-address></listen-…

AD7715

一、芯片概述 1、AD7715是一款适合低频测量应用的完整模拟前端&#xff0c;可直接接受来自传感器的低电平输入信号&#xff0c;并产生串行数字输出。AD7715采用Σ-Δ转换技术&#xff0c;可实现最高16位无失码性能。 2、CMOS构造可确保获得极低的功耗&#xff0c;省电模式则将采…

0817a

https://zhidao.baidu.com/question/1302230504869242619.html

『1157』Anniversary

Zhejiang University is about to celebrate her 122th anniversary in 2019. To prepare for the celebration, the alumni association (校友会) has gathered the ID’s of all her alumni. Now your job is to write a program to count the number of alumni among all th…