小助手科技_小程序定制开发图片

小助手科技_小程序定制开发图片

小助手科技_小程序定制开发图片

小助手科技_小程序定制开发图片

小助手科技_小程序定制开发图片

Nginx1.15.5安装

作者: 小助手科技
来源: http://www.l-helper.com
时间: Aug 14, 2020
当前位置:  小助手科技 > 资讯 > Nginx1.15.5安装

Nginx1.15.5安装

1    下载文件

#wget http://nginx.org/download/nginx-1.15.5.tar.gz

#wget http://nginx.org/download/nginx-1.15.5.tar.gz.asc

2    校验文件

#gpg  --verify nginx-1.15.5.tar.gz.asc nginx-1.15.5.tar.gz

# gpg --keyserver pgpkeys.mit.edu --recv-key A1C052F8

image.png

3    解压文件

# tar -xzvf nginx-1.15.5.tar.gz -C /soft

4    添加用户

# groupadd nginx

# useradd nginx -g nginx -s /sbin/nologin -M

image.png

5    创建相关目录

 

//创建缓存目录在/var/tmp/nginx/

[root@7Core ~]# mkdir -pv /var/tmp/nginx/{client_body,proxy,fastcgi,uwsgi,scgi}

//赋予Nginx用户权限

[root@7Core ~]# chown -R nginx:nginx /var/tmp/nginx/

//创建日志目录在/usr/local/nginx/

[root@7Core ~]# mkdir -pv /usr/local/nginx/logs

//赋予Nginx用户权限

[root@7Core ~]# chown -R nginx:nginx /usr/local/nginx/

6    安装基本环境

# yum -y install gcc gcc-c++ autoconf automake make wget vim

# yum -y install openssl openssl-devel libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed libtool zlib zlib-devel pcre pcre-devel patch

 

另外一种安装方案:

# yum -y install gcc* pcre* pcre-devel* zlib* zlib-devel* openssl* openssl-devel*

7    安装PCRE-8.42NginxRewrite功能)

当前目录为:/soft/waresoft/nginx

# wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz

# tar -zxvf pcre-8.42.tar.gz

#cd pcre-8.42/ && ./configure && make && make install && cd ..

8    安装Zlib-1.2.11NginxGzip压缩功能)

# wget https://www.openssl.org/source/openssl-1.1.1-pre8.tar.gz

# tar -zxvf openssl-1.1.1-pre8.tar.gz

# cd openssl-1.1.1-pre8 && ./config && make && make install && cd ..

9    安装nginx-sticky-module

# wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gz

# tar -zxvf master.tar.gz

# mv nginx-goodies-nginx-sticky-module-ng-08a395c66e42/ nginx-sticky-module/

#mv nginx-sticky-module/ /soft/nginx-1.15.5/

1.10      安装Nginx-1.15.5

# ./configure \

--prefix=/usr/local/nginx \

--sbin-path=/usr/sbin/nginx \

--conf-path=/etc/nginx/nginx.conf \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--pid-path=/var/run/nginx.pid  \

--lock-path=/var/lock/nginx.lock \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_v2_module \

--with-http_dav_module \

--with-http_flv_module \

--with-http_realip_module \

--with-http_addition_module \

--with-http_xslt_module \

--with-http_stub_status_module \

--with-http_sub_module \

--with-http_random_index_module \

--with-http_degradation_module \

--with-http_secure_link_module \

--with-http_gzip_static_module \

--with-http_perl_module \

--add-module=../nginx-sticky-module \

--with-pcre=../pcre-8.42 \

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

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

--with-file-aio \

--with-mail \

--with-mail_ssl_module \

--http-client-body-temp-path=/var/tmp/nginx/client_body \

--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 \

--with-stream \

--with-ld-opt="-Wl,-E"

 

SSL安装

#./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/ssl

1.11      配置完成后编译并安装Nginx

# make && make install

12      Nginx加入systemctl管理服务

# vim /usr/lib/systemd/system/nginx.service

 [Unit]

Description=nginx - high performance web server

After=network.target remote-fs.target nss-lookup.target

[Service]

Type=forking

ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf

ExecReload=/usr/sbin/nginx -s reload

ExecStop=/usr/sbin/nginx -s stop

[Install]

WantedBy=multi-user.target

13      给予文件754权限

# chmod 754 /usr/lib/systemd/system/nginx.service

14      启动Nginx服务器

# systemctl start nginx

# systemctl enable nginx

 

15      修改或新增文件需要执行以下语句才能生效

# systemctl daemon-reload

 

16      查看Nginx服务启动状态

# systemctl status nginx

 


上一篇: Tomcat9.0.12安装

想了解更多?现在就开始免费体验

请您留言
深圳市小助手科技有限公司
0755-82494862
小助手科技_姓名图片
小助手科技_电话图片
小助手科技_邮箱图片
类型咨询类型
小助手科技_类型图片
180 0250 1799(微信同号)
0755-8249 4862
services@l-helper.com
深圳市福田区泰然八路18号安华工业园6栋705室
QQ交谈 QQ交谈
友情链接:
网站地图
Copyright 2014-2020 深圳市小助手科技有限公司-版权所有
ICP备案号:粤ICP备15072167号-1