怎么上传文件到腾讯云Linux服务器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎么上传文件到腾讯云Linux服务器相关的知识,希望对你有一定的参考价值。

Step1. 在云服务器配置FTP服务
1.在root权限下,通过如下命令安装Vsftp。

[root@VM_250_202_tlinux ~]# yum install vsftpd

2.在启动vsftpd服务之前,需要登录云服务器修改配置文件,将匿名登录禁用掉。打开配置文件,命令如下:

[root@VM_250_202_tlinux ~]# vim /etc/vsftpd/vsftpd.conf

在配置文件中第11行的“anonymous_enable=YES”前面加上#号,即将匿名登录禁用。

3.读取生效配置。

[root@VM_250_202_tlinux ~]# cat /etc/vsftpd/vsftpd.conf |grep ^[^#] local_enable=YESwrite_enable=YESlocal_umask=022anon_upload_enable=YESanon_mkdir_write_enable=YESanon_umask=022dirmessage_enable=YESxferlog_enable=YESconnect_from_port_20=YESxferlog_std_format=YESlisten=YESpam_service_name=vsftpduserlist_enable=YEStcp_wrappers=YES

4.启动vsftpd服务。

[root@VM_250_202_tlinux ~]# service vsftpd start

5.设置FTP用户账号。设置成功后,即可通过该账号登录FTP服务器。(1)设置FTP用户的账号,例如账号为“ftpuser1”,目录为/home/ftpuser1,且设置不允许通过ssh登录。

[root@VM_250_202_tlinux ~]# useradd -m -d /home/ftpuser1 -s /sbin/nologin ftpuser1

(2)设置账号对应的密码,例如密码为“ftpuser1”。

[root@VM_250_202_tlinux ~]# passwd ftpuser1

6.修改vsftpd的pam配置,使开发者可以通过自己设置的FTP用户帐号和密码连接到云服务器。(1)修改pam。

[root@VM_250_202_tlinux ~]# vim /etc/pam.d/vsftpd

内容修改为:

#%PAM-1.0 auth required /lib64/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed auth required /lib64/security/pam_unix.so shadow nullok auth required /lib64/security/pam_shells.so account required /lib64/security/pam_unix.so session required /lib64/security/pam_unix.so

(2)确认修改后的文件是否正确。

[root@VM_250_202_tlinux ~]# cat /etc/pam.d/vsftpd#%PAM-1.0 auth required /lib64/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed auth required /lib64/security/pam_unix.so shadow nullok auth required /lib64/security/pam_shells.so account required /lib64/security/pam_unix.so session required /lib64/security/pam_unix.so

(3)重启vsftpd服务,使修改生效。

[root@VM_250_202_tlinux ~]# service vsftpd restartShutting down vsftpd: [ OK ]Starting vsftpd for vsftpd: [ OK ]

Step2. 上传文件到Linux云服务器

1.下载并安装开源软件FileZilla请使用FileZilla的3.5.1、3.5.2版本(使用3.5.3版本的FileZilla进行FTP上传会有问题)。由于FileZilla 官网上只提供了最新的3.5.3版本下载,因此建议开发者自行搜索3.5.1、3.5.2下载地址。建议的3.5.1 下载地址:http://www.oldapps.com/filezilla.php?old_filezilla=6350

2.连接FTP运行FileZilla,按下图所示进行配置,配置后点击“快速链接”:

配置信息说明如下:(1)主机:云服务器的公网IP(在云服务器“管理视图”页面可查看云服务器的公网IP)。(2)用户名:在Step1中设置的FTP用户的账号,这里以“ftpuser1”为例。(3)密码:在Step1中设置的FTP用户账号对应的密码,这里以“ftpuser1”为例。(4)端口:FTP监听端口,默认为“21”。

3.上传文件到Linux云服务器上传文件时,鼠标选中本地文件,拖拽到远程站点,即将文件上传到了Linux云服务器。注意:云服务器FTP通道不支持上传tar压缩包后自动解压,以及删除tar包功能。
参考技术A 通过ftp软件来上传文件。
ftp软件可以去问度娘搜索下载使用。
登录的账号密码可以去腾讯云控制台获取。

Linux配置 xampp下的https证书(腾讯云申请)

准备

从腾讯云后台SSL证书管理里下载证书

一、上传文件

解压出来以后有三个文件:

1_root_bundle.crt
2_www.xxxxx.com.crt
3_www.xxxxx.com.key

将1_root_bundle.crt文件上传到/opt/lampp/etc目录下
将2_www.xxxxx.com.crt文件上传到/opt/lampp/etc/ssl.crt目录下
将3_www.xxxxx.com.key文件上传到/opt/lampp/etc/ssl.key目录下

二、编辑httpd-ssl.conf文件

vi /opt/lampp/etc/extra/httpd-ssl.conf

找到

<VirtualHost _default_:443>

更改成以下

<VirtualHost _default_:443>
#   General setup for the virtual host
DocumentRoot "/opt/lampp/htdocs"
ServerName www.example.com:443
ServerAdmin you@example.com
ErrorLog "/opt/lampp/logs/error_log"
TransferLog "/opt/lampp/logs/access_log"

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   Server Certificate:
#   Point SSLCertificateFile at a PEM encoded certificate.  If
#   the certificate is encrypted, then you will be prompted for a
#   pass phrase.  Note that a kill -HUP will prompt again.  Keep
#   in mind that if you have both an RSA and a DSA certificate you
#   can configure both in parallel (to also allow the use of DSA
#   ciphers, etc.)
#   Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
#   require an ECC certificate which can also be configured in
#   parallel.
SSLCertificateFile "/opt/lampp/etc/ssl.crt/2_www.xxxxx.com.crt"

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you\'ve both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
#   ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/3_www.xxxxx.com.key"

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convenience.
SSLCertificateChainFile "/opt/lampp/etc/1_root_bundle.crt"

三、强制跳转到HTTPS

vi /opt/lampp/etc/httpd.conf

找到

DocumentRoot "/opt/lampp/htdocs"

更正为

DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn\'t give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/trunk/mod/core.html#options
    # for more information.
    #
    #Options Indexes FollowSymLinks
    # XAMPP
    Options Indexes FollowSymLinks ExecCGI Includes

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    #AllowOverride None
    # since XAMPP 1.4:
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
	#新增内容
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

</Directory>

四、重启xampp

/opt/lampp/lampp restart

(转发请注明出处:http://www.cnblogs.com/zhangyongli2011/ 如发现有错,请留言,谢谢)

以上是关于怎么上传文件到腾讯云Linux服务器的主要内容,如果未能解决你的问题,请参考以下文章

腾讯云服务器linux系统盘满了怎么办

搭建腾讯云Linux服务器(Centos6)入门教程

请高手指教下:腾讯云主机由linux系统重装改到windows系统后,FTP远程连接失败怎么解决

如何在 Windows 使用 FTP 上传文件到 Linux 服务器上

花几十块买了个腾讯云服务器,但是我在那服务器写了个简单基础的PHP上传文件的代码,总是显示出错被拒绝

Mac/Linux/Centos终端中上传文件到Linux云服务器