zoukankan      html  css  js  c++  java
  • nginx: [alert] kill(5272, 15) failed (3: No such process) 启动不了,apache搞得鬼

    1.启动

    sudo nginx
    Password:
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    

    2.stop

    sudo nginx -s stop
    nginx: [alert] kill(5272, 15) failed (3: No such process)
    
    
    1. 通过nginx.conf 找 nginx.pid 位置, 然后删除
    cat /usr/local/etc/nginx/nginx.conf | grep .pid
    #pid        logs/nginx.pid;
    

    然而找不到
    找找找到了....
    /usr/local/var/run/nginx.pid
    查看下

    cat /usr/local/var/run/nginx.pid
    5272
    

    与nginx: [alert] kill(5272, 15) failed (3: No such process) 碰头成功,
    删除该ngix.pid文件,重启

    然而不行

    sudo nginx
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
    

    .......⚠️漫长百度.....

    mac默认安装了apache,随机启动会占用80端口,导致nginx启动不了,需要关闭apache(httpd)服务,取消随机启动。

    执行命令

    查询80端口被谁占用了
    sudo lsof -i:80

     sudo lsof -i:80
    COMMAND    PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    httpd       80  root    4u  IPv6 0x1cc38b1a603f3a93      0t0  TCP *:http (LISTEN)
    httpd      251  _www    4u  IPv6 0x1cc38b1a603f3a93      0t0  TCP *:http (LISTEN)
    
    

    关闭随机启动

    sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    

    就启动了

    sudo nginx
     jihan@jihandeMacBook-Pro � ~ � ps aux | grep nginx
    jihan             6842   0.0  0.0  4258648    200 s000  R+   12:58下午   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox nginx
    nobody            6821   0.0  0.0  4295208   1144   ??  S    12:58下午   0:00.00 nginx: worker process
    nobody            6820   0.0  0.0  4295208   1144   ??  S    12:58下午   0:00.00 nginx: worker process
    nobody            6819   0.0  0.0  4287016   1156   ??  S    12:58下午   0:00.00 nginx: worker process
    nobody            6818   0.0  0.0  4295208   1164   ??  S    12:58下午   0:00.00 nginx: worker process
    nobody            6816   0.0  0.0  4295208   1156   ??  S    12:58下午   0:00.00 nginx: worker process
    nobody            6815   0.0  0.0  4303400   1148   ??  S    12:58下午   0:00.00 nginx: worker process
    nobody            6814   0.0  0.0  4295208   1156   ??  S    12:58下午   0:00.00 nginx: worker process
    nobody            6813   0.0  0.0  4295208   1144   ??  S    12:58下午   0:00.00 nginx: worker process
    root              6812   0.0  0.0  4285528    540   ??  Ss   12:58下午   0:00.00 nginx: master process nginx
    

    相关命令

    关闭随机启动
    sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    开启随机启动
    sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    启动apache
    
    sudo apachectl start
    重启apache
    
    sudo apachectl restart
    停止apache
    
    sudo apachectl stop
    
    
  • 相关阅读:
    WPF画辐射图
    WPF 获取表格里面的内容
    C# 动态生成Html地图文件
    C#如何关闭指定进程
    oracle EM 打不开 503 |OracleDBConsoleorcl 启动不了
    oracle windows 下修复无监听错误-12541/12514
    Oracle 命令汇总
    oracle 函数 bitand 与 decode
    一.Git 初步扫盲
    修改字段类型
  • 原文地址:https://www.cnblogs.com/smallyi/p/14517228.html
Copyright © 2011-2022 走看看