Centos7 在线源码安装Nginx

  1. 使用wget命令 下载nginx 1.9.5 源码    下载到/usr/nginx 目录下nginx

     wget  -nd -p --directory-prefix=/usr/nginx http://nginx.org/download/nginx-1.9.5.tar.gz服务器

  2. 解压源码    到/usr/nginx 目录ui

    tar -zxvf   /usr/nginx/nginx-1.9.5.tar.gz -C   /usr/nginxspa

  3. 编译源码orm

    cd /usr/nginx/nginx-1.9.5 ip

    输入   ./configure --prefix=/usr/nginx/nginx   安装到/usr/nginx/nginx  目录
    get

    可能报一下错误源码

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

    You can either disable the module by using --without-http_rewrite_moduleio

    option, or install the PCRE library into the system, or build the PCRE library

    statically from the source with nginx by using --with-pcre=<path> option.

    http模块 rewrite 缺乏PCRE 依赖库 

    出现如下错误

                   ./configure: error: the HTTP gzip module requires the zlib library.

                     You can either disable the module by using --without-http_gzip_module

                      option, or install the zlib library into the system, or build the zlib library

                      statically from the source with nginx by using --with-zlib=<path> option

      gzip 压缩模块  缺乏 zlib 依赖库  

   清除 编译安装过程当中临时文件   

        make clean   清除上次的make命令所产生的object文件(后缀为“.o”的文件)及可执行文件。 

       make distclean  相似make clean,但同时也将configure生成的文件所有删除掉,包括Makefile文件

4.进入   sbin 目录 启动nginx  

    ./nginx

   注意:服务器防火墙必须放开 80端口  

相关文章
相关标签/搜索