• centos安装nginx


    1.检查依赖

      检查gcc编译器

        rpm -qa|grep gcc

      ssl功能需要openssl库

        rpm -qa|grep openssl

      gzip模块需要zlib库

        rpm -qa|grep zlib

      rewrite模块需要pcre库

        rpm -qa|grep pcre

      若没有直接通过yum安装

        yum install -y gcc

        yum install -y pcre pcre-devel

        yum install -y zlib zlib-devel

        yum install -y openssl openssl-devel

    2.官网 http://nginx.org/en/download.html 或wget下载 nginx-1.14.2.tar.gz

      cd /home/tar

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

      cp /home/tar/nginx-1.14.2.tar.gz /opt

      cd /opt

      tar -zxvf nginx-1.14.2.tar.gz

    3.编译安装

      cd /opt/nginx-1.14.2

      ./configure --with-http_stub_status_module --with-http_ssl_module

      make

      make install

      nginx默认安装在 /usr/local/nginx

    4.开放80端口

      systemctl status firewalld.service

      systemctl start firewalld.service

      systemctl stop firewalld.service

      firewall-cmd --zone=public --add-port=80/tcp --permanent

      firewall-cmd --reload

    5.基本操作

      /usr/local/nginx/sbin/nginx  #启动

      /usr/local/nginx/sbin/nginx -t  #测试配置信息

      /usr/local/nginx/sbin/nginx -v  #显示版本信息

      /usr/local/nginx/sbin/nginx -V  #显示编译时的参数

      /usr/local/nginx/sbin/nginx -s stop  #快速停止服务

      /usr/local/nginx/sbin/nginx -s quit  #正常停止服务

      /usr/local/nginx/sbin/nginx -s reload  #重启

    6.根据需求修改 nginx.conf 配置文件

      不定期更新

    7.基本命令

      启动:/usr/local/nginx/sbin/nginx

      快速停止:/usr/local/nginx/sbin/nginx -s stop

      完整有序的停止:/usr/local/nginx/sbin/nginx -s quit

      重新加载:/usr/local/nginx/sbin/nginx -s reload

      强制停止:

        ps -ef | grep nginx

        kill -9 xxx

      指定配置文件:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    8.表达式配置

      见参考文章 location 系列

    9.问题 

      Q: nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:38

      A: 编译时添加ssl模块 ./configure --with-http_ssl_module

      

    参考文章:

      https://www.cnblogs.com/wtcl/p/9508854.html 基本安装

      https://www.cnblogs.com/lxcmyf/p/8433909.html 开放端口

      https://www.cnblogs.com/milton/p/9693836.html 设置用户

      https://www.cnblogs.com/cheyunhua/p/7927674.html location详解

      https://my.oschina.net/u/1266221/blog/877208 location表达式

      https://www.jb51.net/article/143420.htm location表达式详解

      

  • 相关阅读:
    c#命名空间
    MUTC 2 B Meeting point1 二分
    高斯消元模板
    MUTC 2 C Meeting point2 切比雪夫距离orz
    MUTC 2 E Save the dwarfs DP?
    Uva 10859 Placing Lampposts 树形dp
    Uva 11552 Fewest Flops 字符串dp
    Uva 10891 Game of Sum dp博弈
    MUTC 2 D Matrix 并查集
    Uva 1456 Cellular Network 概率dp
  • 原文地址:https://www.cnblogs.com/tarencez/p/10692639.html
Copyright © 2020-2023  润新知