Back

使用ssh搬迁网站数据

|

在两个都提供ssh权限的主机之间转移数据非常简单。这里假设网站数据都存储在public\_html文件夹中。ssh登入原主机,使用tar命令打包源数据:

```
tar cvf site.tar ~/public_html /*将public_html文件夹打包到site.tar里面*/
```

ssh登入新主机,使用ftp命令取得源数据包:

```
ftp olddomainname.com /*FTP登入原主机*/
cd ~ /*进入源数据包所在目录*/
get site.tar /*使用get命令下载源数据包,等待下载完成*/
tar xvf filename.tar /*解压源数据包*/
```

修改解压出来的文件路径,使之与新主机的文件结构相符。
网站文件转移完毕,转移数据库,修改一些配置文件,整个迁移过程结束。

No comments yet

Leave a comment

About me

I live in Tasmania, an island a little far from the rest of the world and very close to the sea.
Father of two little girls, have two puppies.

Work

Work in IT industry, AI is my working partner.