• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

centos7编译安装nginx的方法步骤

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

安装nginx编译所需的lib库

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

查看pcre(正则库)版本

pcre-config --version

进入编译目录

cd /usr/local/src

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

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

解压nginx压缩包

tar -zxvf nginx-1.14.0.tar.gz

进入解压目录

cd nginx-1.14.0

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

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

编译安装nginx

make && make install

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

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

启动nginx

nginx

设置开机自启动

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

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

执行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

查看nginx安装目录

whereis nginx

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持极客世界。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Nginx 重定向时获取域名的方法示例发布时间:2022-02-12
下一篇:
详解nginx平滑升级的过程发布时间:2022-02-12
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap