欢迎来到资源库(www.zyku.net)

CentOS

当前位置:首页 > 服务器教程 > CentOS > 编译安装

CentOS 7编译安装Nginx的方法

时间:2018-07-21|栏目:CentOS|点击:|我要投稿

1、安装nginx编译所需的lib库

yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
yum -y install pcre pcre-devel

2、查看pcre(正则库)版本

pcre-config --version

3、进入编译目录

cd /usr/local/src

4、从官网下载最新的nginx(stable version稳定版)

wget http://nginx.org/download/nginx-1.14.0.tar.gz

5、解压nginx压缩包

tar -zxvf nginx-1.14.0.tar.gz

6、进入解压目录

cd  nginx-1.14.0

7、运行配置脚本(--prefix参数指定nginx安装的目录,默认安装在/usr/local/nginx )

./configure --prefix=/usr/local/nginx

8、编译安装nginx

make && make install

9、将nginx执行命令软链接到/usr/bin

ln -s /usr/local/nginx/sbin/nginx /usr/bin

10、启动nginx

nginx

11、设置开机自启动

echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local

以上就是整个安装过程...

12、执行nginx -h查看相关命令

[root@localhost ~]# nginx -h
nginx version: nginx/1.14.0
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h         : this help
-v            : show version and exit
-V            : show version and configure options then exit
-t            : test configuration and exit
-T            : test configuration, dump it and exit
-q            : suppress non-error messages during configuration testing
-s signal     : send signal to a master process: stop, quit, reopen, reload
-p prefix     : set prefix path (default: /usr/local/nginx/)
-c filename   : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file

13、查看nginx安装目录

whereis nginx

原文链接:https://www.jianshu.com/p/ae2638b5f01c

(资源库 www.zyku.net)

上一篇:Centos7搭建FTP服务器

栏    目:CentOS

下一篇:OneinStack安装GoGetSSL Comodo Free SSL证书的方法(证书申请安装)

本文标题:CentOS 7编译安装Nginx的方法

本文地址:https://www.zyku.net/centos/1626.html

关于我们 | 版权申明 | 寻求合作 |

重要申明:本站所有的文章、图片、评论等内容,均由网友发表或上传并维护或收集自网络,仅供个人学习交流使用,版权归原作者所有。

如有侵犯您的版权,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:95148658 | 邮箱:mb8#qq.com(#换成@)

苏ICP备2020066115号-1

本网站由提供CDN加速/云存储服务