zoukankan      html  css  js  c++  java
  • nginx安装

    1、nginx依赖包安装

    依赖包安装顺序依次为:gcc、gccopenssl、zlib、pcre
    依赖包下载地址:https://pkgs.org/ 选择对应的操作系统,找到对应的包名,进入详情链接,查看dowload,访问下载地址查找对应链接找到匹配依赖包进行下载。

    1)gcc(c++编译环境)
    nginx是C语言开发。
    安装命令:yum install gcc-c++
    2)openssl
    OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。nginx不仅支持http协议,还支持https(即在ssl协议上传输http)。
    下载地址: https://www.openssl.org/source/
    安装命令:
    tar -zxvf openssl-1.1.0c.tar.gz
    cd openssl-1.1.0c
    ./config && make && make install
    3)zlib
    zlib库提供了很多种压缩和解压缩的方式。nginx使用zlib对http包的内容进行gzip。
    下载地址:http://www.zlib.NET/
    安装命令:
    tar -zxvf zlib-1.2.8.tar.gz
    cd zlib-1.2.8
    ./configure && make && make install
    4)pcre
    PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginx的http模块使用pcre来解析正则表达式。
    下载地址: http://www.pcre.org/
    安装命令:
    tar -zxvf pcre-8.39.tar.gz
    cd pcre-8.39
    ./configure && make && make install

    2、nginx安装

    下载地址:http://nginx.org/download/ nginx-1.13.1.tar.gz
    安装命令:
    tar -zxvf nginx-1.13.1.tar.gz
    cd nginx-1.13.1
    ./configure && make && make install

    3、修改nginx配置文件

    注:若nginx已启动,配置文档修改后,需重启nginx
    1)http修改:在gzip on后面插入服务器的集群,upstream后面填写的需匹配server填写的Url地址映射
    例:
    //人员管控 服务器的集群
    upstream rygk { #服务器集群的名字
    ip_hash;
    server 192.168.23.107:8083;
    server 192.168.23.111:8083;
    }
    如下所示:

    2)server修改,在sever_name后面插入URL地址映射,rygk名称对应修改成tomcat下webapps下的文件夹名称
    例:
    //Url地址映射 人员管控服务器
    location /rygk {
    proxy_pass http://rygk;
    }
    如下所示:

    3)应用系统修改
    URL地址修改:dids-client-config.properties文件修改,修改ip和端口替换成nginx服务器的IP

    4、启动nginx

    查找nginx路径:whereis nginx
    进入nginx目录:cd /usr/local/nginx/sbin
    启动: ./nginx
    停止: ./nginx -s stop
    重新读取配置: ./nginx -s reload

    启动报错问题的解决方法:

    创建软连接命令:ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
    创建完成后再次启动nginx

    5、验证nginx是否启动成功

    1)查看进程是否启动,命令:ps -ef | grep nginx
    2)通过 http://ip 查看是否启动成功

    6、查找nginx的安装路径

    find / -name nginx.conf

  • 相关阅读:
    grunt in webstorm
    10+ Best Responsive HTML5 AngularJS Templates
    响应式布局
    responsive grid
    responsive layout
    js event bubble and capturing
    Understanding Service Types
    To add private variable to this Javascript literal object
    Centering HTML elements larger than their parents
    java5 新特性
  • 原文地址:https://www.cnblogs.com/seamy/p/15638838.html
Copyright © 2011-2022 走看看