Linux builds a file server (vsftpd)

1. Install the vsftpd component

Detect whether the vsftpd software is installed

#rpm -qa |grep vsftpd

Install

#yum -y install vsftpd

Installation directory /etc/vsftpd, default storage directory /var/ftp/pub

 

Start the ftp command #service vsftpd start

Stop ftp command #service vsftpd stop

Restart the ftp command #service vsftpd restart

 

2. The firewall opens port 21

Browser access: ftp://ip:21/ The default port is 21

ftp://47.112.98.6/

 

3. Open file upload

Create a user, the user here has nothing to do with FTP, it is only used to log in

useradd ftpuser #The default home directory is /home/ftpuser

passwd ftpuser

[Enter password 2 times]

 

Disable anonymous access

Modify the /etc/vsftpd/vsftpd.conf file

anonymous_enable=NO

 

4. HTTP access to pictures

install nginx

Always add configuration to the nginx configuration file

    server {

        listen  9080;

        server_name  localhost;

        location / {

            root /home/;

        }

    }

 

Browser access picture: http://47.112.98.6:9080/ftpuser/hello1.png

 

Common file servers: samba+web, ftp+web, nfs+web, rsync one-way synchronization, distributed storage

The two types of samba+web and ftp+web need to change the program code, and they are not used much;

rsync one-way synchronization is used in a small environment;

nfs+web is most used in medium-sized environments;

In large-scale environments, distributed storage is used for massive files, such as hadoop.

 

Guess you like

Origin blog.csdn.net/w13528476101/article/details/91895379