Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3837
  • 博文数量: 8
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2019-09-07 00:37
文章分类
文章存档

2020年(3)

2019年(5)

我的朋友

分类: LINUX

2020-04-12 01:22:50

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好
下载软件

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

mkdir nginx-src
cd nginx-src
wget 
wget 
wget 
tar zxvf *.gz
cd 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 指定的路径请使用绝对路径

错误处理

如果在执行 configure 时报如下错误:

checking for OS
 + Darwin 19.2.0 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found

尝试执行 gcc 出如下错误

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

执行:xcode-select --install 根据界面提示操作

继续安装
./configure --with-pcre=../pcre-8.41/ --with-http_ssl_module --with-openssl=../openssl-1.1.0g --prefix=/Users/winterlau/nginx

可看到相关信息如下:

Configuration summary
  + using PCRE library: ../pcre-8.41/
  + using OpenSSL library: ../openssl-1.1.0g
  + using system zlib library
开始编译安装
make
make install
启动 Nginx 并测试

由于默认的 nginx 运行在 80 端口上,因此需要有管理员的权限:

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

打开浏览器访问

阅读(257) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~