[转帖]nginx1.17.2版本源码安装

nginx1.17.2版本源码安装

公众号里面的内容 这里简单测试了下

在x86的虚拟机里面编译安装 nginx 仅make make install nginx17.2的时间
配置E5-2630V2的CPU.  耗时 220s 

在arm 四核飞腾1500A的PC机器上面4c8g的国产机器上面
同样的nginx17.2的        耗时 580s

注意 CPU是 飞腾FT1500A
设备是浪潮申泰DT3000-F 

一:安装NGINX依赖项

1:PCRE - 支持正则表达式。NGINX Core和Rewrite模块需要。

$ wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz

$ tar -zxf pcre-8.42.tar.gz

$ cd pcre-8.42

$ ./configure

$ make

$ sudo make install

2:zlib - 支持标头压缩。NGINX Gzip模块需要。

$ wget http://zlib.net/zlib-1.2.11.tar.gz

$ tar -zxf zlib-1.2.11.tar.gz

$ cd zlib-1.2.11

$ ./configure

$ make

$ sudo make install

3:OpenSSL - 支持HTTPS协议。NGINX SSL模块和其他人员要求。

$ wget http://www.openssl.org/source/openssl-1.1.1b.tar.gz

$ tar -zxf openssl-1.1.1b.tar.gz

$ cd openssl-1.1.1b

./config --prefix=/usr/local/ssl shared zlib-dynamic

$ make

$ sudo make install

二:安装ngixn-1.17.2版本

$ wget https://nginx.org/download/nginx-1.17.2.tar.gz

$ tar zxf nginx-1.17.2.tar.gz

$ cd nginx-1.17.2

./configure --sbin-path=/usr/local/nginx/nginx \

--conf-path=/usr/local/nginx/nginx.conf \

--pid-path=/usr/local/nginx/nginx.pid \

--with-http_ssl_module \

--with-pcre=../pcre-8.43 \

--with-zlib=../zlib-1.2.11 \

--with-openssl=../openssl-1.1.1b \

三:centos7.x将nginx服务添加到开机自启

1:创建nginx.service文件

vim /lib/systemd/system/nginx.service

[Unit]

Description=nginx service

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/nginx/nginx

ExecReload=/usr/local/nginx/nginx -s reload

ExecStop=/usr/local/nginx/nginx -s quit

PrivateTmp=true

[Install]

WantedBy=multi-user.target

2:这时在systemctl服务列表里就能看见nginx.service了

systemctl list-unit-files | grep nginx

3:将nginx服务加到自启

systemctl enable nginx.service

四:防火墙开放80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent

firewall-cmd --reload

五:启动nginx服务

systemctl start nginx.service

猜你喜欢

转载自www.cnblogs.com/jinanxiaolaohu/p/11362099.html