nginx配置代理ftp

2023-06-13 15:14:46 浏览数 (2)

# 配置文件如下

打开nginx.conf

代码语言:javascript复制
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}
stream {
  upstream ftp{
        #hash $remote_addr consistent;
        server ftp.cmegroup.com:21;
    }

server {
        listen 21;
        #listen 20;
        proxy_connect_timeout 300s;
        proxy_timeout 300s;
        proxy_pass ftp;
   }
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '

在需要访问代理的服务器上设置hosts

代码语言:javascript复制
8.210.13.112 ftp.cmegroup.com

访问成功

代码语言:javascript复制
[root@host-172-16-40-12 ~]# ftp ftp.cmegroup.com
Connected to ftp.cmegroup.com (8.210.13.112).
220-This system is for authorized CME Group users only.
220-
220-Individuals using or accessing this system are subject to having all
220-activities on this system monitored, logged and/or recorded.
220-Anyone using or accessing this system expressly consents to such
220-monitoring, logging and/or recording and is advised that if such
220-monitoring, logging and/or recording reveals possible evidence of criminal
220-activity, improper usage or hacking, systems personnel
220-may provide the evidence of such monitoring, logging and/or recording to
220-management, governmental authorities and/or any other
220-third parties.  Any attempted hacking or use of hacking tools on this
220-machine (or any other associated or related system) will
220-be pursued under corporate guidelines as well as under all applicable
220-federal, state and local laws and regulations.
220 
Name (ftp.cmegroup.com:root):

0 人点赞