CentOS主机备份

CentOS主机备份

主域名博客备份

文件备份

使用tar -zcvf 1.tar.gz lujq.me命令压缩虚拟主机文件夹,并下载到本地;

数据库备份

phpMyAdmin 备份相应的数据库,下载到本地;

nginx配置备份

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
server {
listen 80;
listen 443 ssl;
server_name lujq.me;
ssl on;
ssl_certificate /etc/ssl/private/lujq_me.crt;
ssl_certificate_key /etc/ssl/private/lujq_me.key;
root /home/wwwroot/lujq.me/;
access_log off;
index index.html index.htm index.php;
include wordpress.conf;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4";
keepalive_timeout 70;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security max-age=63072000;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
location ~ .*\.(php|php5)?$ {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|pdf|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
server {
server_name resume.lujq.me;
root /home/wwwroot/lujq.me/resume/;
access_log off;
index index.html index.htm index.php;
location ~ .*\.(php|php5)?$ {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|pdf|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}

SSL证书备份

/etc/ssl/private/lujq_me.crt
/etc/ssl/private/lujq_me.key
/etc/ssl/private/lujq_me.csr
/usr/local/nginx/conf/ssl/

Node网站备份

MongoDB备份

mongodump -h dbhost -d dbname -o dbdirectory
-h:
MongDB所在服务器地址,例如:127.0.0.1,当然也可以指定端口号:127.0.0.1:27017
-d:
需要备份的数据库实例,例如:test
-o:
备份的数据存放位置,例如:/opt,当然该目录需要提前建立,在备份完成后,系统自动在/opt目录下建立一个目录,这个目录里面存放该数据库实例的备份数据。

tar -zcvf 1.tar.gz DB压缩并下载到本地。