日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

mac brew 啟動服務時報錯“Bootstrap failed: 5: Input/output error”

作者:王建文 更新時間: 2022-05-06 編程語言

1.brew services start nginx時報錯

?  brew services start nginx
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/wangjianwen/Library/LaunchAgents/homebrew.mxcl.nginx.plist` exited with 5.

2.找到nginx應用程序目錄,直接執行

直接執行程序目的是,看到更準確的報錯提示,作出相應處理。

2.1進入到nginx的plist文件

獲取到nginx的應用程序路徑為:
/usr/local/opt/nginx/bin/nginx

vi ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>homebrew.mxcl.nginx</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/opt/nginx/bin/nginx</string>
                <string>-g</string>
                <string>daemon off;</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>WorkingDirectory</key>
        <string>/usr/local</string>
</dict>
</plist>

2.2 直接啟動nginx

發現問題:nginx要用到的8080端口被占用

?   /usr/local/opt/nginx/bin/nginx
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] still could not bind()

2.3 查看端口占用情況

? lsof -i:8080
COMMAND    PID        USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
?\x81?  1376 wangjianwen   45u  IPv4 0xff7509a8126c8535      0t0  TCP bogon:53409->reverse.gdsz.cncnet.net:http-alt (ESTABLISHED)
?\x81?  1376 wangjianwen   63u  IPv4 0xff7509a811edcff5      0t0  TCP bogon:53618->157.255.245.177:http-alt (ESTABLISHED)
?\x81?  1376 wangjianwen   93u  IPv4 0xff7509a819bd5ff5      0t0  TCP bogon:53418->157.255.245.177:http-alt (ESTABLISHED)
java      1601 wangjianwen   44u  IPv6 0xff7509a81e1f135d      0t0  TCP *:http-alt (LISTEN)

2.4 kill掉所有占用8080端口的進程,然后重啟nginx,啟動成功

?  brew services stop nginx
Stopping `nginx`... (might take a while)
==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)
?  brew services start nginx
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)

原文鏈接:https://blog.csdn.net/Haikuotiankong11111/article/details/123442845

欄目分類
最近更新