A, ftp concept?
/ * Ftp and http protocol is a protocol are called protocol tcp and udp is the protocol ftp file (transmitted as a stream) transmission protocol (for files to upload and download) * / 1 . If you have multiple ftp server station , the server does not recognize the problem: 1.1 Add field (ftp_server) in the user table -> for update of the field according to a user number of ftp uploads 1.2 has a field (head_pic) in the user table -> deposit. ftp server path where image -> the query to the route server used subString intercepting the IP address of two duplicate file names: user id of the number of the current time + ms + arbitrary random number 3 . no irregular document storage easier to find and post-maintenance: can be sub-folders based on the current date 2019/08/31 ---> August 2019 No. 31 stored images / file ---> PIC ---> file ---> write filter (filter suffix all pictures) -> return if true ---> deposit file -> otherwise credited pic
Two, ftp configuration?
1 . Ftp configuration: (use with nginx, to ensure the safety of the project) Requirements: all ftp servers can not be called ftp Linux user name can not be called ftp, and will install ftp conflict, leading to ftp can not start in the new linux configuration, HOSTNAME can not be called ftp 1 on linux .1 detect whether or not already installed ftp commands: / * RPM -qa | grep vsftpd RPM -qa | grep vsftpd RPM -qa | grep vsftpd RPM -qa | grep vsftpd RPM - qa | grep vsftpd RPM -qa | grep vsftpd RPM -qa | grep vsftpd * / on linux ftp server called vsftpd if nothing is displayed, the linux ftp not been installed 1 .2 install ftp / * yum -y install vsftpd yum -y install vsftpd yum -y install vsftpd yum -y install vsftpd yum -y install vsftpd yum -y install vsftpd yum -y install vsftpd */ 看到以下信息说明安装成功: Running Transaction Installing : vsftpd-2.2.2-24.el6.x86_64 1/1 Verifying : vsftpd-2.2.2-24.el6.x86_64 1/1 Installed: vsftpd.x86_64 0:2.2.2-24.el6 Complete! Start ftp (and firewalls) / * Service Start vsftpd start service vsftpd stop stop service vsftpd restart restart * / see the following instructions to start successfully: Starting vsftpd for vsftpd: [the OK] 1.4 Setting the ftp boot. / * ON the vsftpd the chkconfig the chkconfig the vsftpd ON the chkconfig the vsftpd ON the chkconfig the vsftpd ON the chkconfig the vsftpd ON the chkconfig the vsftpd ON the chkconfig the vsftpd ON the chkconfig vsttpd ON * / for 1.5 . configuration FTP // 1.3 linux ftp will be installed by default in the / etc directory Vsftpd is configured in the conf directory command: / * vi /etc/vsftpd/vsftpd.conf vi /etc/vsftpd/vsftpd.conf vim /etc/vsftpd/vsftpd.conf vim /etc/vsftpd/vsftpd.conf vim / etc /vsftpd/vsftpd.conf vim /etc/vsftpd/vsftpd.conf vim /etc/vsftpd/vsftpd.conf vim /etc/vsftpd/vsftpd.conf * / # prohibit anonymous user anonymous login anonymous_enable = NO # allow local users to log local_enable = YES # allow users logged in has write access (upload, delete) write_enable = YES # Default the umask local_umask = 022 # log records saved to the transmission / var / log / different vsftpd.log three places xferlog_enable = YES xferlog_file = / var / log / vsftpd.log xferlog_std_format is = NO # enable ASCII upload ascii_upload_enable = YES # ASCII mode allows to download ascii_download_enable = YES # port to transfer data using the number 20 connect_from_port_20 = YES # welcome sign ftpd_banner = is available for purchase to the Test My use the FTP Server. / * # The next three configuration is very important # chroot_local_user set YES, then all users by default will be chroot, # will be limited to the user directory under your home, not up change directory. # Chroot_list_enable set YES, that is, make a list of valid user chroot. # ★ super important: If chroot_local_user set YES, then chroot_list_file file # set in, is not to be chroot users (you can change the directory up) # ★ super important: If chroot_local_user set NO, then chroot_list_file file # set in, is chroot users (can not change directory up) * / chroot_local_user = NO (!!!!! pit, when using Java to connect and ftp upload, If YES, does not automatically create the directory information file) chroot_list_enable = YES Touch #/ etc / vsftpd / chroot_list new (created manually) // created in the directory vsftpd chroot_list Touch chroot_list_file = / etc / vsftpd / chroot_list # to run on standalone mode ipv4 the listen = YES # PAM authentication service name, here is the default vsftpd , when you install vsftpd has created the pam file # in /etc/pam.d/vsftpd, according to the pam file settings, / etc / vsftpd / ftpusers # file users will be banned from ftp server, such as such sensitive root user, so you have to ban other users when # logged, the user can also appended to the / etc / vsftpd / ftpusers inside. pam_service_name = the vsftpd . 6 . Restart FTP / * vsftpd restart Service vsftpd restart Service Service vsftpd restart Service vsftpd restart Service vsftpd restart Service vsftpd restart Service vsftpd restart Service vsftpd restart Service vsftpd restart setsebool 1 -P ftp_home_dir* / see the following instructions to restart success: Shutting Down vsftpd: [the OK] Starting vsftpd for vsftpd: [the OK] 7 execute the following five commands that allow configuration to take effect just need to wait for some time. . . This five command to wait for slower / * getsebool -a | grep ftpd setsebool 1 -P allow_ftpd_full_access setsebool -P allow_ftpd_use_cifs 1 setsebool -P allow_ftpd_use_nfs 1 * / 8 . Creating ftp user is created in the root directory. useradd ftp username (ftpuser) -s / sbin / nologin -d / home / ftp (hand written under the home directory and no ftp folder) commands: / * useradd ftpuser -s / sbin / nologin -d / home / FTP the useradd ftpuser -s / sbin / nologin -d / Home / FTP the useradd ftpuser -s / sbin / nologin -d / Home / FTP the useradd ftpuser -s / sbin / nologin -d / Home / FTP the useradd ftpuser -s / sbin / -d nologin / Home / the FTP useradd ftpuser -s / sbin / nologin -d / Home / the FTP * / / Home / the FTP -> future when the user to upload files to the root directory 9 . Set a password for ftp user username passwd ftp's (ftpuser) Enter / * useradd ftpuser useradd ftpuser useradd ftpuser useradd ftpuser useradd ftpuser useradd ftpuser * / I created in the root directory. See the following instructions to set a password success: Changing password for the User ftpuser. New password: BAD PASSWORD: IT IS TOO simplistic / Systematic BAD PASSWORD: IS TOO the Simple the Retype new new password: passwd:. All authentication tokens successfully Updated 10 .filezilla connection ftp All the ftp directory must be used ftpuser the user to create folders and files, you can not use the root, may result not be recognized (root user does not have permission) configuration nginx: 1 . Use xftp the nginx uploaded to the linux server 2 decompression nginx. tar - zxvf xxxx 3 . create a shortcut to enter nginx directory created first install the necessary configuration package nginx / * yum -y install gcc PCRE-devel OpenSSL OpenSSL-devel yum -y install gcc PCRE-devel OpenSSL OpenSSL-devel yum PCRE-devel gcc install -y OpenSSL OpenSSL-devel Yun -y install gcd PCRE-devel OpenSSL OpenSSL-devel * / create shortcut / * ./configure --prefix=/usr/local/nginx-1.17.3 ./configure --prefix=/usr/local/nginx-1.17.3 ./configure --prefix=/usr/local/nginx-1.17.3 ./configuer --prefix=/usr/local/nginx-1.17.3 ./configuer --prefix=/usr/local/nginx-1.17.3 ./configuer --perfix=/usr/local/nginx-1.17.3 ./ */ 4.编译nginx /* make && make install make && make install make && make install make && make install make && make install make && make install make && make install */ 5.Modify nginx configuration /usr/local/nginx-1.17.3 / conf directory modification vim nginx.conf to open a line of user annotation user the nobody; ---> user root do not remove LOCATION / whatever label LOCATION / { root (to access the root directory) / Home / FTP / WWW; } 6. the start nginx in sbin / directory. . / Nginx