Centos7 源码安装nginx

1、官方自行下载nginx源码

2、切换到解压后的nginx目录中执行:

      ./configure --prefix=/opt/demo/nginx --add-module=/home/fastdfs-nginx-module/src  --with-http_stub_status_module --with-http_ssl_module

      参数说明:

        --prefix 用于指定nginx编译后的安装目录

        --add-module 为添加的第三方模块,此次添加了fdfs的nginx模块

        --with..._module 表示启用的nginx模块,如此处启用了http_ssl_module模块

根据需要来自行选择,如下是我的执行脚本

./configure --prefix=/home/songxiaohu/nginx-1.16.0/nginx   --with-http_stub_status_module --with-http_ssl_module

3、

 可能出现的错误:

                             出现./configure: error: C compiler cc is not found

                                   解决办法:yum -y install gcc gcc-c++ autoconf automake make

        出现:./configure:  error: the HTTP rewrite module requires the PCRE library.

          解决方法:yum -y install pcre-devel

        出现:SSL modules require the OpenSSL library

          解决方法:yum install openssl-devel 

4、执行

         ./configure --prefix=/home/songxiaohu/nginx-1.16.0/nginx   --with-http_stub_status_module --with-http_ssl_module

5、编译

       执行make 进行编译,如果编译成功的话会在第一步中objs中出现一个nginx文件

6、安装

执行make install 进行安装,安装后--prefix 中指定的安装目录下(此处为:/home/songxiaohu/nginx-1.16.0/nginx)存在相关的文件

7、启动nginx

nginx的一些常用管理命令

                     启动:nginx –c ../conf/nginx.conf

      重启:nginx -s reload

      停止:nginx -s stop或者是通过kill nginx进程号

      查看版本:nginx –V

至此,大功告成,支持原创

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值