zoukankan      html  css  js  c++  java
  • nginx 跳转

     nginx 跳转

    一.需求:当需要在别的机访问本机房的服务器问题。

    虚拟主机头配置

     1     server {
     2         listen       80;
     3         server_name test.zlx.com;
     4         location / {
     5         if ($request_method = 'DELETE' ) {
     6                         return 405;
     7                         }
     8                proxy_pass http://test;
     9                  }
    10 
    11         location = /404.html {
    12              root    /home/usr/local/nginx/html;
    13                           }
    14         location = /403.html {
    15              root    /home/usr/local/nginx/html;
    16                           }
    17         location = /500.html {
    18              root    /home/usr/local/nginx/html;
    19                           }
    20         location = /502.html {
    21              root    /home/usr/local/nginx/html;
    22                           }
    23         location = /503.html {
    24              root    /home/usr/local/nginx/html;
    25                           }
    26         location = /504.html {
    27              root    /home/usr/local/nginx/html;
    28                           }
    29                 }
    30 
    31 
    32     server {
    33         server_name test.zlx.com;
    34         listen 443;
    35 
    36     ssl on;
    37     ssl_certificate    /home/usr/local/nginx/cert/323432432.pem;
    38     ssl_certificate_key   /home/usr/local/nginx/cert/324324324.key;
    39     ssl_session_timeout 5m;
    40     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    41     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    42     ssl_prefer_server_ciphers on;
    43 
    44 
    45 #################################################################
    46         location / {
    47         if ($request_method = 'DELETE' ) {
    48                         return 405;
    49                         }
    50 
    51                proxy_pass http://test;
    52        }
    53 #################################################################
    54 
    55         location = /404.html {
    56              root    /home/usr/local/nginx/html;
    57                           }
    58         location = /403.html {
    59              root    /home/usr/local/nginx/html;
    60                           }
    61         location = /500.html {
    62              root    /home/usr/local/nginx/html;
    63                           }
    64         location = /502.html {
    65              root    /home/usr/local/nginx/html;
    66                           }
    67         location = /503.html {
    68              root    /home/usr/local/nginx/html;
    69                           }
    70         location = /504.html {
    71              root    /home/usr/local/nginx/html;
    72                           }
    73     }
    View Code

    最后在host文件修改

    别的机房的Ip   test.zlx.com

    最后进行访问。

  • 相关阅读:
    SharePoint提交前有效性验证
    showModalDialog/showModelessDialog弹出窗刷新例子
    在多选用户字段中查找是否存在某个用户(转自JianYi博客)
    SQL获得月第一天等
    SQL如何将Null不参与计算
    自定义Icon字段
    Backup Exec Remote Agent 在远程服务器上启动时挂起,一直显示Starting状态
    一个好用的日期控件My97DatePicker
    使用错误页统一处理错误(转)
    MS SQL游标的使用
  • 原文地址:https://www.cnblogs.com/zoulixiang/p/9412264.html
Copyright © 2011-2022 走看看