zoukankan      html  css  js  c++  java
  • nginx 代理FTP && iptables 转发FTP

    nginx

    user root;
    worker_processes 8;
    worker_rlimit_nofile  40960;
    
    events {
        use epoll;
            worker_connections 102400;
    }
    
    http {
    
    
            sendfile on;
            tcp_nopush on;
            tcp_nodelay on;
            keepalive_timeout 120;
            types_hash_max_size 2048;
            server_tokens off;
            fastcgi_buffers 8 128k;
            send_timeout 60;
            proxy_headers_hash_max_size 51200;
            proxy_headers_hash_bucket_size 6400;
    
            include /usr/local/openresty/nginx/conf/mime.types;
            default_type application/octet-stream;
    
    
            ssl_prefer_server_ciphers on;
    
            proxy_ignore_client_abort on;
            #access_log /var/log/nginx/access.log;
            #error_log /var/log/nginx/error.log;
    
    
            gzip on;
            gzip_disable "msie6";
    
    
    
            include /usr/local/openresty/nginx/sites-enabled/*;
    }
    
    stream {
    
        upstream cloudsocket {
           hash $remote_addr consistent;
          # $binary_remote_addr;
           server 133.64.36.129:21;
        }
        server {
           listen 21;#数据库服务器监听端口
           proxy_connect_timeout 300s;
           proxy_timeout 300s;#设置客户端和代理服务之间的超时时间,如果5分钟内没操作将自动断开。
           proxy_pass cloudsocket;
        }
    }
    View Code

    客户机添加配置

    iptables -t nat -A OUTPUT -d ftp-ip -p tcp --dport 21 -j DNAT --to-destination nginx-ip
    View Code

    iptables转发

    iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d ftp-ip -o enp4s1 -j MASQUERADE
    View Code

    客户机添加配置

    route add -host 133.64.36.129 gw 192.168.1.60 
    
    ftp ftp-ip 
    
    #切换被动模式
    passive
    lcd /tmp/ 
    put test.txt 
    View Code
  • 相关阅读:
    python -django 之第三方支付
    python 的排名,已经python的简单介绍
    第三方登录
    linux 基础命令
    JWT 加密
    Docker 简介
    中文分词库:结巴分词
    Django websocket 长连接使用
    jQuery截取字符串的几种方式
    Python 操作redis
  • 原文地址:https://www.cnblogs.com/hanwei666/p/14912764.html
Copyright © 2011-2022 走看看