zoukankan      html  css  js  c++  java
  • nginx搭建(centos7)

    1、安装前准备:

          系统: CentOS 7.5 x64

          下载包:wget 

    yum -y install wget

    安装:

    2、安装一下这些依赖条件:

    yum install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel

    3、 nginx下载:

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

    4、解压tar包

    tar -zvxf nginx-1.10.3.tar.gz

    5、进入到解压后的文件夹中

    6、安装配置

    ./configure --with-http_ssl_module --with-http_gzip_static_module

        这边加了两个选项,--with-http_ssl_module表示使用ssl模块,--with-http_gzip_static_module表示使用gzip模块,其它更详细的配置就要参考nginx的文档      了:http://nginx.org/en/docs/configure.html

    7、make && make install

    make
    make install

      成功后,

      程序位置:/usr/local/nginx/sbin/nginx 

      配置文件位置:/usr/local/nginx/conf/nginx.conf

    8、启动nginx

    切换到/usr/local/nginx/sbin/目录下,

    ./nginx -t 判断配置是否正确,若正确,则可启动nginx

    注意:如果运行的时候不带-c参数,那就采用默认的配置文件,即/etc/nginx/nginx.conf

    查看运行进程状态:

    说明已经启动成功

    直接在浏览器上输入ip地址即可看到如下信息:

    至此,nginx安装成功

    附:其他常用nginx命令

    停止nginx:
    #./nginx -s stop
    
    重启nginx(配置文件变动后需要重启才能生效):
    #./nginx -s reload
    
    检查配置文件是否正确:
    #./nginx -t
    
    查看nginx的pid:
    cat /usr/local/nginx/logs/nginx.pid
    
    查看nginx版本
    $ ./nginx -v
    
    回头看编译配置
    # ./nginx -V
  • 相关阅读:
    从数据库表中查询日期最新的记录
    ArcGIS js api开发环境配置
    HRESULT:0x80070057 (E_INVALIDARG)
    ArcGIS js api三种查询功能
    sql设置字段默认值
    文件后缀与mime类型对应表
    关于dojo自定义类
    android用户登录验证
    java实现QQ互联登录
    springboot实现网站微信扫码登录
  • 原文地址:https://www.cnblogs.com/UniqueColor/p/9118583.html
Copyright © 2011-2022 走看看