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;
        }
    }
    

      

  • 相关阅读:
    jquery另外一种类似tab切换效果
    简单的Tab切换组件
    switchable图片切换
    web前端性能优化总结
    iframe之间通信问题及iframe自适应高度问题
    javascript cookie
    grunt项目构建工具
    input全选与单选(把相应的value放入隐藏域去)
    Ajax跨域问题
    Jquery回到顶部功能
  • 原文地址:https://www.cnblogs.com/kingdelee/p/9866634.html
Copyright © 2011-2022 走看看