zoukankan      html  css  js  c++  java
  • CentOS7 安装nginx-1.14.0

    nginx源码包:http://nginx.org/en/download.html

    1.安装gcc gcc是用来编译下载下来的nginx源码

    yum install gcc-c++

    2、安装pcre和pcre-devel

        PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。
        nginx 的 http 模块使用 pcre 来解析正则表达式,pcre-devel 是使用 pcre 开发的一个二次开发库。

    yum install -y pcre pcre-devel

    3、安装zlib zlib提供了很多压缩和解方式,nginx需要zlib对http进行gzip

    yum install -y zlib zlib-devel

    4、安装openssl openssl是一个安全套接字层密码库,nginx要支持https,需要使用openssl

    yum install -y openssl openssl-devel

    5. 下载nginx 

    wget http://nginx.org/download/nginx-1.14.0.tar.gz

    6.解压

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

    7. cd到文件路劲

    cd /usr/local/nginx-1.14.0

    8.编译

    ./configure --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tem/nginx/client --http-proxy-temp-path=/var/tem/nginx/proxy --http-fastcgi-temp-path=/var/tem/nginx/fcgi --with-http_stub_status_module

    9.安装

    make && make install

    10.启动

    nginx -c /etc/nginx/nginx.conf

    11. 如果出现[emerg] getpwnam("nginx") failed 错误 执行

    useradd -s /sbin/nologin -M nginx
    id nginx

    12.如果出现 [emerg] mkdir() "/var/temp/nginx/client" failed (2: No such file or directory) 错误 执行

    sudo mkdir -p /var/tem/nginx/client

    13.如果您正在运行防火墙,请运行以下命令以允许HTTP和HTTPS通信:

    sudo firewall-cmd --permanent --zone=public --add-service=http 
    sudo firewall-cmd --permanent --zone=public --add-service=https
    sudo firewall-cmd --reload

    14.nginx 重启

    方法一:进入nginx可执行目录sbin下,输入命令./nginx -s reload 即可

    whereis nginx #查找nginx文件目录
    cd /usr/sbin/
    ./nginx -s reload

    方法二:查找当前nginx进程号,然后输入命令:kill -HUP 进程号 实现重启nginx服务

    ps -ef|grep nginx
    kill -9 进程ID

    15.nginx 配置文件检测

    nginx -t -c /etc/nginx/nginx.conf

     启动

    cd /usr/sbin
    ./nginx -s stop
    ps -ef|grep nginx
    nginx -c /etc/nginx/nginx.conf
  • 相关阅读:
    大数据综合案例--搜狗搜索日志分析
    大数据综合案例-网站日志分析
    Python格式化字符串
    python爬虫---selenium库的用法
    python爬虫---BeautifulSoup的用法
    python爬虫---requests库的用法
    python爬虫---urllib库的基本用法
    Codeforces Round #501 (Div. 3) ABDE1E2
    2018 Multi-University Training Contest 4 B Harvest of Apples 莫队算法
    莫队算法
  • 原文地址:https://www.cnblogs.com/reasonzzy/p/11427881.html
Copyright © 2011-2022 走看看