
(1)问题现状
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)
(2)问题原因
(3)解决方案
查询端口是否被占用 :netstat -nlput | grep 80
查询占用端口的进程 : lsof -i :80
杀死进程 : kill -9 33877,kill -9 33878
之后启动服务即可 2、Nginx启动失败
(1)问题现状
http://hadoop102:80
(2)问题原因定位
查看nginx的log文件下的error.log日志
本人原因(nginx代理端口与springboot端口配置不一致)
2022/01/18 11:18:59 [error] 105361#0: *5 connect() failed (111: Connection refused) while connecting to upstream, clie nt: 192.168.6.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://192.168.6.104:8081/", host: "hadoop10 2" 2022/01/18 11:18:59 [error] 105361#0: *5 connect() failed (111: Connection refused) while connecting to upstream, clie nt: 192.168.6.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://192.168.6.103:8081/", host: "hadoop10 2" 2022/01/18 11:18:59 [error] 105361#0: *5 connect() failed (111: Connection refused) while connecting to upstream, clie nt: 192.168.6.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://192.168.6.102:8081/", host: "hadoop10 2" 2022/01/18 11:18:59 [error] 105361#0: *5 no live upstreams while connecting to upstream, client: 192.168.6.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "http://logcluster/favicon.ico", host: "hadoop102", referre r: "http://hadoop102/
(3)解决方案
打开配置文件,
cd /opt/module/nginx/conf vim nginx.conf
修改如下配置
http{ #gzip on;
#配置代理服务器
upstream logcluster{
server hadoop102:8081 weight=1;
server hadoop103:8081 weight=1;
server hadoop104:8081 weight=1;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
#代理的服务器集群,命名随意,但是不能出现下划线
proxy_pass http://logcluster;
proxy_connect_timeout 10;
}
......
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)