It's not easy for our webmaster to build a website. From domain name registration, mastering the basic configuration of the virtual host or VPS, to security protection, building a website, image processing, publishing articles, SEO, etc., we are proficient in everything, but the most important work in this is actually website backup! Don't trust the backup promises of server vendors. The most reliable thing is to do it yourself.
Weieis Blog Usually, it is backed up manually on a regular basis Manually backing up websites and databases in the lnmp environment Step of.
First, we use the Xshell to connect VPS. Enter the directory above the website directory. For example, my website directory is/home/wwwroot/www.vpss.net/. Enter the following command:
cd /home/wwwroot/
Format: tar - zcvf compressed file name. tar.gz compressed file name/folder name
Example:
tar -zcvf www.vpsss.net.tar.gz www.vpsss.net
The front www.vpss.net.tar.gz is the name I gave to the compressed file, and the back www.vpss.net is the name of the website folder. I do this for the convenience of memory. You can just name it as you like.
At this time, our website folder is compressed and stored under/home/wwwroot/, which is its parent folder.
There are two cases involving FTP permissions:
1. If your FTP permission is under wwwroot, you can directly use ftp to connect to VPS, find the compressed file and download it.
2. If your FTP permission is under vpss.net, the website folder, you need to use a command to move files.
Format: mv [options] source file or directory target file or directory
Example:
mv www.vpsss.net.tar.gz www.vpsss.net
That is, move the package www.vpss.net.tar.gz to the folder www.vpss.net.
Now use ftp to connect to your VPS to download the compressed package of this website.
The above steps are to back up and download the website files. Next, we will also download the website php database.
If you read the lnmp tutorial on the Weieis blog along the way, you will know that when you finish installing lnmp, there is a prompt interface as follows:
The phpmyadmin address in the red box is: https://Your website IP/phpmyadmin/
Enter the PHP database user name and password to enter.
1. Click your website database name on the left
2. Click "Export" on the right
3. Click "Execute" below
4. A dialog box will pop up to save the database file to the local computer.
The above is The lnmp environment backs up website files and php databases In the whole process, Weiaisi Blog tries to be easy to understand and comprehensive, while many of the online tutorials are relatively simple (only a few key lines of code are mentioned). Considering that novices get confused when they see the command line of Linux, they write a little wordy, and the blogger has also come here. In fact, the process of writing the tutorial is also the blogger's review several times, You will be familiar with it if you use it more.
We need to be familiar with the common format of Linux commands, instead of being as comprehensive as scientific research. Originally, Linux+php was a boring thing, most of which were command lines. For example, some online tutorials introduce the Linux system, php database, phpmyadmin management, and php environment from the beginning. There are a lot of theories. After reading them for a long time, people are confused or don't know how to build a php environment.
Our goal is to build a wordpress website in the lnmp environment. It's really not necessary to learn too much Linux theoretical knowledge. We can achieve this goal as quickly as possible. We should focus more on website construction.