• linux 安装nginx yum


    本分类下有一个环境一键安装.那这背后发生了什么呢?咱们手动使用源码进行安装.
    1.首先保证有一个能联网的centos.
    2.百度 ningx 官网   点download  http://nginx.org/en/download.html  找到最新版的nginx下载地址. 发贴时最新的是1.12 http://nginx.org/download/nginx-1.12.0.tar.gz
    3.进行centos  执行命令

    #安装wget
    yum install wget -y
    #安装gcc和c++编译器
    yum install gcc gcc-c++ -y
     
    错误提示:
    ./configure: error: the HTTP rewrite module requires the PCRE library.
     
    安装pcre-devel与openssl-devel解决问题
     
    yum -y install pcre-devel openssl openssl-devel
     
    ./configure --prefix=/usr/local/nginx
    make
    make install
     
    4.新建临时目录  /temp  然后下载并解压. 命令如下
    mkdir /temp;
    cd /temp;
    wget http://nginx.org/download/nginx-1.12.0.tar.gz
    tar zxvf ./nginx-1.12.0.tar.gz
    cd /temp/nginx-1.12.0
     
    得到路径:
    [root@localhost nginx-1.12.0]# pwd
    /temp/nginx-1.12.0
    [root@localhost nginx-1.12.0]# ll
    total 724
    drwxr-xr-x. 6 1001 1001   4096 Apr 17 11:42 auto
    -rw-r--r--. 1 1001 1001 277049 Apr 12 22:46 CHANGES
    -rw-r--r--. 1 1001 1001 421985 Apr 12 22:46 CHANGES.ru
    drwxr-xr-x. 2 1001 1001   4096 Apr 17 11:42 conf
    -rwxr-xr-x. 1 1001 1001   2481 Apr 12 22:46 configure
    drwxr-xr-x. 4 1001 1001   4096 Apr 17 11:42 contrib
    drwxr-xr-x. 2 1001 1001   4096 Apr 17 11:42 html
    -rw-r--r--. 1 1001 1001   1397 Apr 12 22:46 LICENSE
    drwxr-xr-x. 2 1001 1001   4096 Apr 17 11:42 man
    -rw-r--r--. 1 1001 1001     49 Apr 12 22:46 README
    drwxr-xr-x. 9 1001 1001   4096 Apr 17 11:42 src
     
     
    5.linux三大安装步骤   配置,编译,安装  第一步,配置
    --prefix=/安装后的路径  注意这基本是所有安装程序的通用的配置属性
    输入命令
     
    ./configure --prefix=/usr/local/nginx-mytest
     
    接下来会报错 如下
    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    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.
    咱们需要安装一个这样的环境对能继续 . 根据上面的意思.咱们先安装 pcre 再指定路径 指定方法在上面就是 --with-pcre=<path>
    6.安装pcre.百度这个词得到官网. 然后找到下载路径如下
    ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/  这里面有一些列表.咱们找到最新的即可 . 目前是 
    ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz下载,解压,编译
     
    mkdir /temp;
    cd /temp;
    wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
    tar zxvf pcre-8.39.tar.gz
     
    到此得到了pcre的源码路径 为/temp/pcre-8.39
    7.上一步得到安装路径/usr/local/pcre-8.39  接下来咱们从新编译 nginx 注意别忘记  --with-pcre=<path>
     
    cd /temp/nginx-1.12.0
    ./configure --prefix=/usr/local/nginx-mytest   --with-pcre=/temp/pcre-8.39
     
    发现完成
    第二个命令就是 make   也就是编译, 一般可以跟第三步一起执行,第三步是make install  .所以我们得到命令
    make && make install
     
    接下来去/usr/local/nginx-mytest看看吧.安装成功了
     
  • 相关阅读:
    javascript中的继承实现
    【414】Code::Blocks增加主题
    【413】C 语言 Command line
    【412】Linux 系统编译 C 程序
    【411】COMP9024 Assignment1 问题汇总
    【410】Linux 系统 makefile 文件
    Solr的入门知识
    Java8新特性
    Linux命令大全
    为博客园博文添加目录的两种方法
  • 原文地址:https://www.cnblogs.com/yx520zhao/p/6722665.html
Copyright © 2020-2023  润新知