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

 

文章链接: https://www.mfisp.com/20567.html

文章标题:Centos7 源码安装nginx

文章版权:梦飞科技所发布的内容,部分为原创文章,转载请注明来源,网络转载文章如有侵权请联系我们!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
建站教程

Centos7上搭建Consul

2023-5-17 12:31:43

建站教程

ENUM类使用说明

2023-5-19 12:26:55

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
客户经理
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索

梦飞科技 - 最新云主机促销服务器租用优惠