zoukankan      html  css  js  c++  java
  • nginx实现ssh和http代理转发

    cat /app/nginx/conf/nginx.conf
    user  www;
    worker_processes  auto;
    events {
        worker_connections  65535;
        }
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        access_log  /app/nginx/logs/access.log  main;
        sendfile        on;
        keepalive_timeout  65;
    }
    stream {
        log_format proxy '$remote_addr [$time_local] '
                     '$protocol $status $bytes_sent $bytes_received '
                     '$session_time "$upstream_addr" '
                     '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
    
        include  /app/nginx/conf/entry.conf;
    }
    
    [root@idn-jumpserver conf]# cat /app/nginx/conf/entry.conf
    include  /app/nginx/conf/ssh-http.conf;
    [root@idn-jumpserver conf]# cat ssh-http.conf 
        server {
            listen     2222;
            proxy_pass 1.12.23.19:2222;
            proxy_connect_timeout 1h;
            proxy_timeout 1h;
            error_log  /app/nginx/logs/error.log
            }
        server {
            listen     80;
            proxy_pass 1.12.23.19:80;
            proxy_connect_timeout 1h;
            proxy_timeout 1h;
            error_log  /app/nginx/logs/error.log
        }

    配置完成后就可以实现ssh中专到目标机器了,注意开启防火墙规则,目标机器开启跳板机允许远程的端口

  • 相关阅读:
    git的搭建与简单实用
    zabbix项目实践
    zabbix的搭建与入门
    zabbix的深入了解
    harbor私有镜像仓库的搭建与使用与主从复制
    tensorflow 在windows下的安装
    word2vec:基本的安装及使用简介
    cs231n(三) 误差反向传播
    cs231n笔记(二) 最优化方法
    cs231n笔记 (一) 线性分类器
  • 原文地址:https://www.cnblogs.com/huanglingfa/p/15547774.html
Copyright © 2011-2022 走看看