momo-88

Linux下端口被占用的解决方法

版权说明:转载请链接鄙人博客:https://www.cnblogs.com/momo-88/

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)
  nginx: [emerg] still could not bind()

2. 解决方法

说明:nginx默认端口是80,可以修改nginx默认端口杀死80端口的所有进程两种方法解决

2.1 修改nginx默认端口

  • 在Linux下查找lnginx的配置文件

  • 进入存放ngnix.conf的目录

  • 用vim编辑器打开,修改默认端口为81,保存退出

  • 启动nginx

  • 在阿里云服务器上开放81端口

注:如果以上这种方法修改后仍然无法访问,则选择下一种方法

2.2 杀死80端口的所有进程

  • 查看80端口使用情况

  • 杀死80端口进程

  • 启动nginx

  • 查看nginx运行情况

  • 通过浏览器访问nginx

分类:

技术点:

相关文章:

  • 2021-11-10
  • 2021-10-25
  • 2022-02-24
  • 2021-05-04
  • 2021-08-27
  • 2021-11-23
  • 2022-01-02
猜你喜欢
  • 2021-12-07
  • 2021-06-01
  • 2022-02-09
  • 2021-11-16
  • 2021-11-23
  • 2021-10-17
相关资源
相似解决方案