Mac M1使用brew安装nginx

  • 时间:2025-10-21 03:09 作者: 来源: 阅读:5
  • 扫一扫,手机访问
摘要:1、使用brew查看本地安装了那些软件brew list2、搜索Nginx是否存在brew search nginx3、查看nginx相关信息brew info nginx1、nginx在本地未安装 2、nginx来源 3、Docroot 文件根目录,代码存放的文件夹,默认/opt/homebrew/var/www 4、默认配置文件位置 /opt/homeb

1、使用brew查看本地安装了那些软件

brew list


Mac M1使用brew安装nginx


2、搜索Nginx是否存在

brew search nginx

Mac M1使用brew安装nginx


3、查看nginx相关信息

brew info nginx

Mac M1使用brew安装nginx


1、nginx在本地未安装2、nginx来源3、Docroot 文件根目录,代码存放的文件夹,默认/opt/homebrew/var/www4、默认配置文件位置 /opt/homebrew/etc/nginx/nginx.conf 默认端口8080 这样nginx就可以在没有sudo的情况下运行5、nginx 将要加载的文件位置 /opt/homebrew/etc/nginx/servers/

4、开始安装nginx

brew install nginx

Mac M1使用brew安装nginx


安装过程中,出现Error: Command failed with exit 128: git

解决方式:输入brew -v 后会提示你执行两个配置命令,直接复制执行

brew -v

Mac M1使用brew安装nginx


1、2是需要执行的命令,3分别执行两条命令

5、再次进行安装,执行安装命令

brew install nginx

Mac M1使用brew安装nginx


6、M1系统安装后的配置文件路径,及默认端口

/opt/homebrew/etc/nginx/nginx.conf to 8080

M1系统nginx文件存放路径

/opt/homebrew/var/www

7、启动 Nginx,启动之后打开 http://localhost:8080/ 链接,就会出现 Welcome to nginx!

nginx

Mac M1使用brew安装nginx


8、停止nginx

1、快速停止    nginx -s stop2、完成所有程序停止   nginx -s quit

9、重启

nginx -s reload
  • 全部评论(0)
手机二维码手机访问领取大礼包
返回顶部