nginx 编译安装支持 ssl

2067人浏览 / 0人评论

nginx 编译安装支持 ssl

[toc] 标签(空格分隔): nginx
##安装编译环境和必要的库 pi@ubuntu:~$ sudo apt-get install gcc g++ autoconf automake libtool make cmake ###编译安装pcre
pi@ubuntu:~$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
pi@ubuntu:~$ tar -zxvf pcre-8.39.tar.gz
pi@ubuntu:~$ cd pcre-8.39
pi@ubuntu:~/pcre-8.39$ ./configure
pi@ubuntu:~/pcre-8.39$ make
pi@ubuntu:~/pcre-8.39$ make install
###下载openssl
pi@ubuntu:~$ wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz
pi@ubuntu:~$ tar -zxvf openssl-1.1.0g.tar.gz
pi@ubuntu:~$ cd openssl-1.1.0g
pi@ubuntu:~/openssl-1.1.0g$ ./config
pi@ubuntu:~/openssl-1.1.0g$ make 
pi@ubuntu:~/openssl-1.1.0g$ sudo make install
###安装zlib库
pi@ubuntu:~$ wget http://zlib.net/zlib-1.2.8.tar.gz
pi@ubuntu:~$ tar -zxvf zlib-1.2.8.tar.gz
pi@ubuntu:~$ cd zlib-1.2.8
pi@ubuntu:~/zlib-1.2.8$ ./configure
pi@ubuntu:~/zlib-1.2.8$ make
pi@ubuntu:~/zlib-1.2.8$ make install

编译安装nginx

pi@ubuntu:~$ wget http://nginx.org/download/nginx-1.12.2.tar.gz
pi@ubuntu:~$ tar -zxvf nginx-1.12.2.tar.gz
pi@ubuntu:~$ cd nginx-1.12.2
pi@ubuntu:~/nginx-1.12.2$ ./configure --sbin-path=/admxj/server/nginx/nginx \
--conf-path=/admxj/server/nginx/nginx.conf \
--pid-path=/admxj/server/nginx/nginx.pid \
--with-http_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-http_v2_module \
--with-pcre=~/pcre-8.39 \
--with-zlib=~/zlib-1.2.8
pi@ubuntu:~/nginx-1.12.2$ make
pi@ubuntu:~/nginx-1.12.2$ make install 
##配置nginx 创建用来运行nginx的用户及组
pi@ubuntu:~$ groupadd www
pi@ubuntu:~$ useradd -M -s /sbin/nologin -g www nginx
./configure --prefix=/usr/local/nginx --with-http_ssl_module --user=nginx --group=nginx --with-pcre