LNMP:快速搬迁方案

备份LNMP操作:

killall nginx
service mysql stop
tar zcvf /home/wwwroot/wwwroot.tar.gz /home/wwwroot
tar zcvf /home/wwwroot/nginx.tar.gz /usr/local/nginx/conf
tar zcvf /home/wwwroot/mysql.tar.gz /usr/local/mysql/var
/usr/local/nginx/sbin/nginx
service mysql start

运行以上命令后,会在wwwroot目录下生成3个备份文件。wwwroot.tar.gz对应网站文件,nginx.tar.gz对应nginx配置文件,mysql.tar.gz对应数据库文件。

将wwwroot.tar.gz、nginx.tar.gz、mysql.tar.gz三个文件上传到目标服务器根目录,后执行以下命令。 恢复LNMP操作:

killall nginx
service mysql stop
tar zxvf wwwroot.tar.gz
tar zxvf nginx.tar.gz
tar zxvf mysql.tar.gz
mv /usr/local/nginx/conf /usr/local/nginx/conf-bak
mv /usr/local/mysql/var /usr/local/mysql/var-bak
mv home/wwwroot /home/wwwroot
mv usr/local/nginx/conf /usr/local/nginx/conf
mv usr/local/mysql/var /usr/local/mysql/var
chown -R mysql /usr/local/mysql/var
chown -R www /usr/local/nginx/conf
/usr/local/nginx/sbin/nginx
service mysql start

发表评论

Crypto logo

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus cursus rutrum est nec suscipit. Ut et ultrices nisi. Vivamus id nisl ligula. Nulla sed iaculis ipsum.

Contact

Company Name

Address