Categories: Linux

编译安装nginx

Nginx的一些模块需要依赖其他第三方库,通常有pcre库(支持rewrite模块),zlib库(支持gzip)和openssl库(支持ssl模块)等

[root@localhost ~]# yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel

[root@localhost ]# mkdir nginx    ####根目录下新建nginx目录

[root@localhost ]# cd nginx           ####进入nginx

[root@localhost nginx]# wget http://nginx.org/download/nginx-1.12.0.tar.gz      ####下载nginx

[root@localhost nginx]# cp nginx-1.12.1.tar.gz /nginx        ####复制到对应目录

[root@localhost nginx]# tar -zxvf nginx-1.12.0.tar.gz        ####解压缩

[root@localhost nginx]# cd nginx-1.13.1

[root@localhost nginx-1.13.1]# ./configure –prefix=/nginx/       ####指定nginx的安装路径

[root@localhost nginx-1.13.1]# make              ####编译

Kai