The last article wrote the “expect script for fast login vsftpd”
https://blog.51cto.com/amunlinux/2426471
This article talks about nginx as a download server , Vsftpd as a combination of upload server.
yum -y install nginx vsftpd
Nginx configuration files
Almost always modify the default configuration
user nginx;
worker_processes auto;< br>error_log /var/log/nginx/error.log;
pid /etc/nginx/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {< br>use epoll;
worker_connections 1024;
}
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on ;
keepalive_timeout 60;
types_hash_max_size 2048;
charset utf-8;
server_tokens off;
server_names_hash_bucket_size 128;
client_header_buffer_size 4;
client_header_timeout 60_timeout 60;
;
large_client_header_buffers 16 512k;
client_max_body_size 5g;
gzip on;
gzip_min_length 1024;
gzip_buffers 16 32k;
gzip_proxied any;
gzip_types text/plain application/x- javascript text/c ss application/xml text/javascript;
limit_conn_zone $binary_remote_addr zone=one:1024m;
#Using a total of 2048M of memory for IP transmission overhead
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 54xxx;
server_name 47.97.xx.xx;
location / {
root /etc/nginx /html/download;
if ($request_filename ~* ^.*?\.(sh||shell|py|perl|pl|go|mp3|mp4|jpg|jpeg|bmp|gif|dmg|tar |xls|rpm|pxt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
#Configure if to download instead of opening it directly in the browser
add_header Content-Disposition:'attachment';
}
autoindex on; #Enable indexing function
autoindex_exact_size off; #Close the calculation of the exact size of the file (in bytes), only the approximate size (in kb) , Mb, gb)
autoindex_localtime on; #Display local time instead of GMT time
sendfile on;
tcp_nopush on;
expires 1h;
#allow 192.168. 4.0/24; #Allow all addresses in segment 4 to access
#allow 192.168.5.0/24; #Allow all addresses in segment 5 to access
#deny all; #Forbid all addresses
}
error_page 404 /404.html;
location = /404.html{
root html;
}
error_page 500 501 502 503 504 505 /50x.html;
location = /50x.html{
root html;
}
}
}
The root location here is: /etc/nginx/ html/download, will be consistent with the local_root of vsftpd, so that it can be uploaded here and there will be there
vsftpd:
[[emailprotected] ~]# cat /etc/vsftpd/vsftpd.conf|grep -v’^#’
anonymous_enable=NO
listen_port=54657
pasv_enable=YES
pasv_min_port=0
pasv_max_port=0
pasv_promiscuous=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
chroot_local_user= YES
listen=YES
local_root=/etc/nginx/html/download
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
This is the same after filtering A few lines
Create vsftpd user
useradd -s /sbin/nologin -d /home/ftpuser ftpuser
passwd ftpuser
Passwd ftpuser
Passwd ftpuser
Customize the password, but you have to remember it for a while I need to log in
chown -R ftpuser:ftpuser /etc/nginx/html/ download
must be changed, otherwise your ftp client will report an error. I have already stepped on the pit. . .
/etc/vsftpd/vsftpd start
Access test:
First level directory
Click to download
Test FileZilla upload and see if nginx displays it.
Test download
This is how this experiment works.
The uneasy client can also be downloaded. Please refer to it for the specific simplicity.
It’s not useful, but it’s useful.
The next document is about “History optimization and automatic display of the new directory name when cd to a new directory”