• 【Nginx】-NO.141.Nginx.1 -【Nginx】


    Style:Mac

    Series:Java

    Since:2018-09-10

    End:2018-09-10

    Total Hours:1

    Degree Of Diffculty:5

    Degree Of Mastery:5

    Practical Level:5

    Desired Goal:5

    Archieve Goal:3

    Gerneral Evaluation:3

    Writer:kingdelee

    Related Links:

    http://www.cnblogs.com/kingdelee/

     

     2.安装编译参数

    实践1:

    需求:

    tomcat:8081

    访问test1.lee.com,通过nginx访问到8081

    启动tomcat

    vim /etc/hosts

    127.0.0.1 test1.lee.com
    127.0.0.1 test2.lee.com
    127.0.0.1 test3.lee.com
    

      

    cd /etc/nginx/conf.d

    vim test1.conf

    server {
        listen       80;
        server_name  localhost test1.lee.com;
    
        location / {
            proxy_pass http://127.0.0.1:8081;
            index  index.html index.htm;
        }
    }
    

    wget test1.lee.com,即可访问到tomcat

      

    大坑:

    代理的时候不能加_,否则无法转发过去,会

    root@localhost test]# wget test1.lee.com
    --2018-10-30 17:55:04--  http://test1.lee.com/
    Resolving test1.lee.com (test1.lee.com)... 127.0.0.1
    Connecting to test1.lee.com (test1.lee.com)|127.0.0.1|:80... connected.
    HTTP request sent, awaiting response... 400
    2018-10-30 17:55:04 ERROR 400: (no description).
    

      

    正确的打开方式:

    upstream test1{
          server 127.0.0.1:8081;
    }
    
    server {
        listen       80;
        server_name  localhost test1.lee.com;
    
        location / {
            proxy_pass http://test1;
            include proxy_params;
            index  index.html index.htm;
        }
    }
    

      

  • 相关阅读:
    (C)const关键字
    (C)volatile关键字
    蛋疼的四旋翼
    多线程之:死锁
    多线程之:ThreadLocal
    多线程之:线程同步代码块
    多线程之:线程安全
    多线程之:竞态条件&临界区
    多线程之:java线程创建
    多线程之:多线程的优缺点
  • 原文地址:https://www.cnblogs.com/kingdelee/p/9866634.html
Copyright © 2020-2023  润新知