- 下载地址 http://nginx.org/en/download.html
- 选择下载Stable version
- 上传到服务器
- 解压到安装目录并删除压缩包
- 尝试编译nginx,先进入到ngixn目录
cd /opt/nginx1.61
./configure --prefix=/opt/nginx
- 编译肯定不通过,需要安装相关的依赖,安装依赖(centos7.6)
./configure: error: the HTTP rewrite module requires the PCRE library.
yum install -y pcre pcre-devel
./configure: error: the HTTP gzip module requires the zlib library.
yum install -y zlib zlib-devel
建议再安装下ssl的库依赖
yum install -y openssl openssl-devel
总的来说就是
yum install -y pcre pcre-devel zlib zlib-devel openssl openssl-devel
在当前文件夹下会生成一个Makefile文件
7. 编译
make
- 安装
make install