当前位置:   article > 正文

Mac os 安装 nginx 教程(success)_mac安装nginx

mac安装nginx

前言

  1. 最近使用Mac系统,从新预习一下nginx,所以写了这篇博客,以便以后和广大好友减少麻烦。
  2. 安装启动完会发现,在Mac下安装nginx,和Linux下安装nginx,其实没有区别。就是先安装三个依赖包,最后安装nginx即可。唯一的区别可能是三个依赖包的安装方式不同罢了。
  3. 注意下最后的bug,很简单,手动创建文件夹即可,原因是因为没有权限创建文件夹而已~

一、homebrew

1、介绍

Mac下包管理工具:homebrew

2、下载安装

安装使用常用命令:
https://blog.csdn.net/qq_35448985/article/details/123988782
安装开始的截图,接着跟着流程执行即可
在这里插入图片描述

二、安装nginx

1、安装前准备

nginx 依赖于 pcre、zlib、openssl

  1. nginx的http模块使用pcre来解析正则表达式,需要在linux上安装pcre
  2. nginx使用zlib对http包的内容进行gzip,需要在linux上安装安装zlib
  3. 安装openssl库,让 nginx 支持 https(即在ssl协议上传输http)

缺少依赖会报错如下错误

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
  • 1
  • 2
  • 3
  • 4

a、安装pcre

  1. 执行命令 brew install pcre
  2. 命令执行如下:
    在这里插入图片描述
    (base) C02ZT6HWLVDL:nginx-1.22.1 alsc$ brew install pcre
    Running `brew update --auto-update`...
    ==> Homebrew has enabled anonymous aggregate formula and cask analytics.
    Read the analytics documentation (and how to opt-out) here:
      https://docs.brew.sh/Analytics
    No analytics have been recorded yet (nor will be during this `brew` run).
    
    ==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
      https://github.com/Homebrew/brew#donations
    
    ==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/pcre-8.45.big_sur.bottle.tar.gz
    ######################################################################## 100.0%
    ==> Pouring pcre-8.45.big_sur.bottle.tar.gz
    
    声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/875891
推荐阅读
相关标签