Mac OS X 10.15 编译和安装 Nginx

想在本身电脑里装个 Nginx 来进行各类测试,下面是详细的过程记录:郑州哪家医院治疗不孕不育好:http://jbk.39.net/yiyuanfengcai/tsyl_zztjyy/986/nginx

1. 下载软件

首先建个临时目录 nginx-src 并下载所需软件的源码进行配置xcode

mkdir nginx-srccd nginx-src
wget http://nginx.org/download/nginx-1.17.8.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz
wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz
tar zxvf *.gzcd nginx-1.17.8
./configure --with-pcre=../pcre-8.41/ --with-http_ssl_module --with-openssl=../openssl-1.1.0g --prefix=/Users/winterlau/nginx

这里咱们将 nginx 安装在 /Users/winterlau/nginx 目录下,prefix 指定的路径请使用绝对路径浏览器

2. 错误处理

若是在执行 configure 脚本时报以下错误:app

checking for OS + Darwin 19.2.0 x86_64checking for C compiler ... not found./configure: error: C compiler cc is not found

尝试执行 gcc 出以下错误ide

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), 
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

执行:xcode-select --install  根据界面提示操做测试

3. 继续安装

./configure --with-pcre=../pcre-8.41/ --with-http_ssl_module --with-openssl=../openssl-1.1.0g --prefix=/Users/winterlau/nginxspa

可看到相关信息以下:郑州哪家不孕不育医院好:http://www.zztjby.com/.net

Configuration summary  + using PCRE library: ../pcre-8.41/  + using OpenSSL library: ../openssl-1.1.0g  + using system zlib library

开始编译安装code

make
make install

4. 启动 Nginx 并测试

因为默认的 nginx 运行在 80 端口上,所以须要有管理员的权限:orm

cd ../../nginx
sudo sbin/nginx

打开浏览器访问 http://localhost

相关文章
相关标签/搜索