• nginx


    1:运用场景: 

         a:是一个http服务可以单独提供http服务,可以做网页静态服务器。

        b:虚拟主机:两台域名对应同一台服务器并且公用80端口。

        c:反向代理,负载均衡:当网站的访问量达到一定程度后,单台服务器不能满足用户请求,可以用nginx反向代理,集群多台服务器。并且平均分担请求。

    2:nginx安装:

          前置环境: a:安装gcc   yum install -y gcc-c++

                            b:安装pcre   yum install -y pcre pcre-devel   (正则表达式库,nginx中http模块使用pcre来解析正则表达式)

                          c:安装zlib   yum install -y zlib zlib-devel (zlib提供很多压缩方式,nginx使用zlib对http包进行zlib)

                        d:安装openssl:  openssl是一个密码库,包括主要密码算法、常用的密钥和证书封装管理功能及ssl协议。nginx不仅支持http,还支持https(及在ssl协议上传输http)

    安装nginx:

    a:将安装包拷贝  /usr/local

    b:解压  tar -zxf  xxxx.tar.gz

               cd nginx-1.8.1

     c:配置 ./configure

     d:编译  make

    e:编译安装  make install

    f:开通80端口

         vim  /etc/sysconfig/iptables

         service iptables restart

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

                       ./nginx

                       ps -aux | grep nginx

    通过端口区分不同的主机: 

        主要是修改niginx下的niginx.conf文件配置

    server {
    listen 80;
    server_name localhost;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location / {
    root html;
    index index.html index.htm;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }
    }
    server {
    listen 88;
    server_name localhost;
    location / {
    root html;
    index index_88.html index.htm;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }

     

    windows修改域名解析文件: c:WindowsSystem32drivershosts

       加:  192.168.174.129   www.baidu.com

    linux修改域名解析文件  /etc/hosts

     

            

       

  • 相关阅读:
    MyBatis学习总结_17_Mybatis分页插件PageHelper
    MyBatis学习总结_16_Mybatis使用的几个建议
    MyBatis学习总结_15_定制Mybatis自动代码生成的maven插件
    MyBatis学习总结_14_Mybatis使用技巧总结
    MyBatis学习总结_13_Mybatis查询之resultMap和resultType区别
    Git实战之Git创建版本库
    Oracle数据库之日期函数
    Oracle数据库之单表查询
    版本发布后测试人员需要做的工作
    oracle数据库之数据插入、修改和删除
  • 原文地址:https://www.cnblogs.com/jcfxl/p/9292135.html
Copyright © 2020-2023  润新知