zoukankan      html  css  js  c++  java
  • 【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;
        }
    }
    

      

  • 相关阅读:
    css hack
    在前端页面开发中所遇到的问题总结
    Animate.css_css3动画库介绍
    响应式内容滑动插件bxSlider
    Combination Sum II
    Subsets
    Combination Sum
    Unique Binary Search Trees II
    Find Median from Data Stream
    Kth Largest Element in an Array
  • 原文地址:https://www.cnblogs.com/kingdelee/p/9866634.html
Copyright © 2011-2022 走看看