1、下载nginx,官方网站https://nginx.org
wget https://nginx.org/download/nginx-1.14.0.tar.gz
2、下载Nginx Sticky Module,官方网站https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng
wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/08a395c66e42.zip
3、解压软件包
tar xfz nginx-1.14.0.tgzunzip 08a395c66e42.zip
4、安装nginx
./configure --with-http_ssl_module --with-http_gzip_static_module --add-module=/home/apuser/nginx-goodies-nginx-sticky-module-ng-08a395c66e42/makemake install
5、启动nginx
/usr/local/nginx/sbin/nginx
6、查看nginx进程
ps aux | grep nginxroot 5413 0.0 0.0 45896 1192 ? Ss 14:42 0:00 nginx: master process /usr/local/nginx/sbin/nginxnobody 5414 0.0 0.0 48376 2044 ? S 14:42 0:00 nginx: worker processroot 5420 0.0 0.0 112664 972 pts/0 S+ 14:42 0:00 grep --color=auto nginx
注:安装过程中如果出现:configure: error: SSL modules require the OpenSSL library
解决方法,执行以下命令:
yum -y install openssl openssl-devel
注:安装过程中如果出现:error: the HTTP rewrite module requires the PCRE library
解决方法,执行以下命令:
yum -y install pcre-devel
链接: