Nginx安装

    xiaoxiao2021-03-25  135

    一、服务器环境

    1、centos7

    二、下载软件

    1、下载官网:http://nginx.org/en/download.html 2、版本号:nginx-1.11.10.tar.gz

    三、开始安装

    1、解压文件

    tar -zxvf nginx-1.11.10.tar.gz -C /usr/local/

    2、Nginx目录进行编译安装

    cd /usr/local/nginx-1.11.10/ ./configure --prefix=/usr/local/nginx make & make install

    3、启动Nginx

    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    常见错误

    在进行./configure 命令的时候经常会因为缺少库文件而报错,如下:

    错误一:缺少gc++库文件

    解决方式:在线安装gcc gcc-++

    yum -y install gcc gcc-++ autoconf automake

    错误二:缺少PCRE库

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

    解决方式:安装pcre-devel解决问题

    yum -y install pcre-devel

    错误三:

    错误提示:./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= options.

    yum -y install openssl openssl-devel

    安装后继续执行configure命令,即可完成Nginx的安装

    ./configure --prefix=/usr/local/nginx

    四、Nginx的启动、停止、重启

    用命令:ps -ef|grep nginx 查看

    root 7954 4087 0 22:36 pts/0 00:00:00 grep --color=auto nginx root 89530 1 0 Mar06 ? 00:00:00 nginx: master process ./nginx -c /usr/local/nginx/conf/nginx.conf nobody 89531 89530 0 Mar06 ? 00:00:01 nginx: worker process

    1、启动

    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    2、关闭

    从容停止 : Kill -QUIT 89530 快速停止 : kill -TERM 89530kill -INT 89530 强制停止 : kill -9 89530
    转载请注明原文地址: https://ju.6miu.com/read-2375.html

    最新回复(0)