Nginx 最新稳定版本安装步骤

一、nginx最新稳定版本为2018-04-17的1.14.0 2018-12-04的1.14.2   2020-04-21的 nginx-1.18.0版本,如需要windows版本请前往官方下载页具体地址为http://nginx.org/en/download.html

若联网了,则可以使用简便安装

1.安装编译环境
#yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel

2.创建用户和组
groupadd -g 402 nginx
useradd -d /usr/local/nginx -g nginx nginx

2.编译配置命令

解压nginx-1.18.0.tar.gz并进入目录下

--user:用户

--group:用户组

--prefix:编译后安装目录

--with:安装的模块
#./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
#make
#make install

(若编译安装成功了,下面的就不需要看了,下面是无外网的安装)

 --------------------------启动/校验/停止----------------

#检查配置文件是否有错误
#./nginx -t
#指定配置文件
#./nginx -c /usr/local/nginx/conf/nginx.conf
#优雅停止
#./nginx -s stop

-------------------------------------------------------------

二、搭建文件下载服务器步骤

1.将nginx-1.14.0.tar.gz上传服务器,tar -zxvf nginx-1.14.0.tar.gz解压文件夹。

2.nginx-1.14.0下建立nginx文件夹(编译安装目录)

  1》在nginx-1.14.0文件夹下运行编译命令: ./configure --prefix=/root/nginx/nginx

  或者用ngin的库命令:./configure --prefix=/root/nginx/nginx --with-pcre=/root/nginx/pcre/pcre-8.32 --with-zlib=/root/nginx/nginx-1.14.0/auto/lib/zlib

其中 --with-pcre=/root/nginx/pcre/pcre-8.32为pcre源码目录其他一样,可在线下载个上传解压https://sourceforge.net/projects/pcre/files/pcre/8.42/pcre-8.42.tar.gz/download

zlib 下载http://www.pan66.com/show/1577781.html

  2》#make && make install,安装完进入/root/nginx/nginx/sbin下运行./nginx -v查看版本。

 

 

  备注:(1)若出现报错,下载PCRE源码解压作为源码目录或安装PCRE。

 

安装PCRE 在线安装 yum install pcre-devel ,其他见https://www.cnblogs.com/virtulreal/p/9803962.html

                   (2)若出现报错,下载zlib源码解压作为原目录。

                   (3)若出现报错,则yum install -y gcc gcc-c++;

 

posted @ 2018-10-17 16:15  王子健  阅读(7528)  评论(0编辑  收藏  举报