准备
1.下载PCRE库,并解压
2.下载zlib库,并解压
3.下载Nginx的最新代码,解压
4.安装openssl和openssl-dev
1 2
| apt install openssl apt install libssl-dev
|
5.创建目录
1 2 3
| mkdir /etc/nginx/ mkdir /var/log/nginx/ mkdir /var/tmp/nginx/
|
编译安装过程
写好各种参数,到Nginx的源码目录下运行配置命令。其中,还要使用参数指向刚才下载的PCRE和zlib库的位置。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| ./configure \ --prefix=/usr/local/nginx \ --conf-path=/etc/nginx/nginx.conf \ --sbin-path=/usr/sbin/ \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --user=www-data \ --group=www-data \ --with-http_ssl_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_realip_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-mail --with-mail_ssl_module \ --with-pcre=../pcre-8.45 \ --with-zlib=../zlib-1.2.11 \ --with-debug \ --http-log-path=/var/log/nginx/access.log \ --error-log-path=/var/log/nginx/error.log \ --http-client-body-temp-path=/var/tmp/nginx/client \ --http-proxy-temp-path=/var/tmp/nginx/proxy \ --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ --http-scgi-temp-path=/var/tmp/nginx/scgi
|
编译并安装