锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

在mac的m1版本安装nginx

时间:2022-08-22 03:30:00 传感器m1

项目场景

尝试在mac的m1版本上进行nginx使用


问题描述

通过brew安装nginx之后,试着开始nginx总是无效或错误,以下是无效指令,结果异常,可作为错误判断的依据之一:

(base) khunone@wangzhaokundeMacBook-Pro ~ % nginx  zsh: killed     nginx (base) khunone@wangzhaokundeMacBook-Pro ~ % brew services start nginx Bootstrap failed: 5: Input/output error Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/khunone/Library/LaunchAgents/homebrew.mxcl.nginx.plist` exited with 5. (base) khunone@wangzhaokundeMacBook-Pro etc % brew services start nginx Bootstrap failed: 5: Input/output error Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/khunone/Library/LaunchAgents/homebrew.mxcl.nginx.plist` exited with 5. (base) khunone@wangzhaokundeMacBook-Pro ~ % launchctl load /opt/homebrew/Cellar/nginx/1.21.6_1/homebrew.mxcl.nginx.plist  Load failed: 5: Input/output error (base) khunone@wangzhaokundeMacBook-Pro ~ % curl http://127.0.0.1:8080 curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused (base) khunone@wangzhaokundeMacBook-Pro ~ % chmod 777 /opt/homebrew/Cellar/nginx  (base) khunone@wangzhaokundeMacBook-Pro ~ % launchctl load /opt/homebrew/Cellar/nginx/1.21.6_1/homebrew.mxcl.nginx.plist Load failed: 5: Input/output error 

原因分析:

提示:可能是brew版本问题!

要支持Apple M1芯片,需要Homebrew 3.0.0以上版本!


解决方案:

提示:重新安装brew,443用于国外:

(base) khunone@wangzhaokundeMacBook-Pro ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"  curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused 

提示:重新安装brew,要用国内的镜像:

(base) khunone@wangzhaokundeMacBook-Pro ~ % /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" 

提示:安装好brew之后,就可以安装了nginx:

(base) khunone@wangzhaokundeMacBook-Pro ~ % brew -v Homebrew 3.4.3-38-g02b0a45 Homebrew/homebrew-core (git revision f13861f5a44; last commit 2022-03-23)
Homebrew/homebrew-cask (git revision 97a52dc06a; last commit 2022-03-23)
(base) khunone@wangzhaokundeMacBook-Pro ~ % brew reinstall nginx

提示:最后测试下nginx是否启动正常:

(base) khunone@wangzhaokundeMacBook-Pro ~ % nginx
(base) khunone@wangzhaokundeMacBook-Pro ~ % curl http://127.0.0.1:8080
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { 
         color-scheme: light dark; }
body { 
         width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

可以!!!!!!

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章