zoukankan      html  css  js  c++  java
  • LNMP搭建02 -- 编译安装Nginx

    【编译安装Nginx】  

     为了顺利安装Nginx,先安装下面这些:



    【CentOS 编译 nginx 前要做的事情】
    yum install gcc gcc-c++ kernel-devel
    yum -y install pcre-devel openssl openssl-devel



    【Ubuntu 编译 nginx 前要做的事情】

    apt-get install gcc

    apt-get install libpcre3 libpcre3-dev

    apt-get install zlib1g zlib1g-dev

    apt-get install openssl openssl-dev

    sudo apt-get install libcurl3-openssl-dev 

    解压 nginx-1.7.4.tar.gz ,然后进入目录,开始编译。

    命令:

    sudo ./configure --prefix=/usr/local/nginx --with-http_stub_status_module

    编译完的界面:

    这个过程可能出现的错误:

    ./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.  You can either disable the module by using --without-http-cache option, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-http_ssl_module --with-openssl=<path> options.  

    解决:

    sudo apt-get install openssl   

    sudo apt-get install libssl-dev   

    然后 make && make install

    使用命令:/usr/local/server/nginx/sbin/nginx 启动Nginx.

    使用命令:/usr/local/server/nginx/sbin/nginx -s reload 重启Nginx.

    使用命令:/usr/local/server/nginx/sbin/nginx -s stop 终止Nginx.

    查看是否已经成功启动nginx

    ps -ef | grep nginx

    或者使用:ps -A | grep -i nginx

  • 相关阅读:
    用nginx解决前端跨域问题
    vue中router-link的详细用法
    leetcode 148 排序链表
    leetcode 146 LRU缓存机制
    leetcode 101 对称二叉树
    leetcode 84 柱状图中最大的矩形
    leetcode76 最小覆盖子串
    C++ map, unordered_map
    python随机函数
    丑数
  • 原文地址:https://www.cnblogs.com/rxbook/p/5993261.html
Copyright © 2011-2022 走看看