Linux operations and architecture-database migration

Source: Internet
Author: User
Tags wordpress blog

First, WordPress Building

1, wordpress download deployment

cd/server/tools/wget https://cn.wordpress.org/wordpress-4.8.1-zh_cn.tar.gzTar XF wordpress-4.8. 1-zh_CN.tar.gzmv WordPress/*  /application/nginx/html/blog/chown-r www.www/ application/nginx/html/blog/Note: Confirm that the hosts file has been parsed browser page input blog.etiantian.org/for WordPress deployment        VIM Wp-config.php can modify the database connection parameter information on WordPress

2, database creation management WordPress users and authorization

CREATE DATABASE wordpress;grant all on WordPress.* To'WordPress'@'172.16.1.%'Identified by'123456';SelectUser,host frommysql.user;grant all on WordPress.* To'WordPress'@'localhost'Identified by'123456'; flush privileges;

3, the basic process of building the site

① to have a website code (to developers)

WordPress Discuz Dedecms ... and other open source software

② into the Code program directory, moving code information to the site Directory

Mv. /* /application/nginx/html/blog/

③ Modify Site Directory permissions

Chown-r www.www/application/nginx/html/blog/

④ for site initialization

 create database wordpress;grant all on WordPress.  * To  " wordpress   " @"  172.16.1. %   " identified by "  oldboy123  "  ;grant all on WordPress.  * To  " wordpress   " @"  localhost   " identified by "  oldboy123  "  ;flush privileges;  

Second, the Database migration

1. Backing Up WEB01 database data

mysqldump-uroot-p123456--all-databases >/tmp/bak_$ (date +%f). sql

2, the backup to the data remote copy to the Independent database Db01 (172.16.1.51) above

scp-rp/tmp/bak_2017--172.16. 1.51:/tmp/

3, DB01 Import number of backup data base information

mysql-uroot-p123456 </tmp/bak_2017--sqlflush privileges;

4, the database migration is complete, modify the Site connection database configuration file

VI wp-   Note: Modify the database IP address of localhost for remote db01 at this point the database of the Web server can stop the service, and the database is migrated.

Third, site data migration to NFS shared directory

1. Move data from the original directory

/application/nginx/html/blog/wp-/tmp/wordpress_backup-pmv uploads/*  /tmp/ wordpress_backup/

2. NFS server above configuration create shared directory

" /data 172.16.1.0/24 (rw,sync,all_squash) " >>/etc/exports/etc/init.d/172.16. 1.31  172.16. 1.31:/data/application/nginx/html/blog/wp-content/uploads//tmp/wordpress_backup/*  .

3. wordpress blog Site configuration file

[email protected] extra]# cat blog.conf     server {        listen       ;        server_name  blog.etiantian.org;         / {            root   html/blog;            Index index.php index.html index.htm;        }         ~ .*\. (PHP|PHP5)? $ {            root   html/blog;            Fastcgi_pass  127.0. 0.1:9000;            Fastcgi_index index.php;            Include fastcgi.conf;        }    }

4, other BBS, CMS site building Similar

Linux operations and architecture-database migration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.