一禽捆,博客搭建
1枷恕、確認環(huán)境
[root@web02 ~]# netstat -lntup|egrep "80|3306|9000"
tcp? ? ? ? 0? ? ? 0 127.0.0.1:9000? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 12214/php-fpm: mast
tcp? ? ? ? 0? ? ? 0 0.0.0.0:80? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 12420/nginx: master
tcp6? ? ? 0? ? ? 0 :::3306? ? ? ? ? ? ? ? :::*? ? ? ? ? ? ? ? ? ? LISTEN? ? ? 7285/mysqld?
2栈拖、下載上傳開源BLOG床牧,解壓策肝,權(quán)限
[root@web02 ~]#? cd /server/tools/
[root@web02 /server/tools]# rz -y
rz waiting to receive.
[root@web02 /server/tools]# ls
libiconv-1.16? ? ? ? ? ? ? ? ? ? ? ? ? ? ? nginx-1.16.0? ? ? ? php-7.3.5.tar.gz
libiconv-1.16.tar.gz? ? ? ? ? ? ? ? ? ? ? ? nginx-1.16.0.tar.gz? wordpress-5.1.1.zip
mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz? php-7.3.5
[root@web02 /server/tools]# unzip wordpress-5.1.1.zip
在[root@web02 /server/tools]# /application/nginx/html/下創(chuàng)建,workdpress
[root@web02 /server/tools]# mv wordpress/* /application/nginx/html/workdpress
給/application/nginx/html/workdpress 權(quán)限
[root@web02 /server/tools]# chown -R nginx.nginx /application/nginx/html/workdpress/ (暫時性)
[root@web02 /server/tools]# ls -ld /application/nginx/html/blog/
drwxr-xr-x 5 nginx nginx 4096 5月? 7 09:14 /application/nginx/html/blog/
3吸奴,設置nginx 配置文件
[root@web02 /application/nginx/conf]#cat nginx.conf
worker_processes? 1;
events {
? ? worker_connections? 1024;
}
http {
? ? include? ? ? mime.types;
? ? default_type? application/octet-stream;
? ? sendfile? ? ? ? on;
? ? keepalive_timeout? 65;
server {
? ? ? ? listen? ? ? 80;
? ? ? ?server_name blog.etiantian.org;
? ? ? ? ?root? html/wordpress;
? ? ? ? ? ? index? index.php index.html index.htm;
? ? ? ? }
? ? ? ? location ~ .*\.(php|php5)?$ {
? ? ? ? ?root html/wordpress;
? ? ? ? ? ? fastcgi_pass? 127.0.0.1:9000;
? ? ? ? ? ? fastcgi_index index.php;
? ? ? ? ? ? include fastcgi.conf;
? ? ? ? }
? ? }
4愧怜,[root@web02 /application/nginx/html/wordpress]#cp wp-config-sample.php wp-config.php
wp-config.php的主要配置
[root@web02 /application/nginx/html/wordpress]#cat wp-config.php
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'root' );
/** MySQL database password */
define( 'DB_PASSWORD', 'oldboy123' );
/** MySQL hostname */
define( 'DB_HOST', '172.16.1.51' );
二呀页,數(shù)據(jù)遷移
#數(shù)據(jù)庫遷移:
從單機web02遷移到DB01獨立的mysql
1,web02:壓縮:
[root@web02 ~]# mysqldump -uroot -poldboy123 -A -B|gzip >/tmp/web02_db.sql.gz
mysqldump: [Warning] Using a password on the command line interface can be insecure.,
2拥坛,拷貝到異機DB01:
[root@web02 ~]# scp /tmp/web02_db.sql.gz 10.0.0.51:/tmp
3蓬蝶,把web02的數(shù)據(jù)庫關閉
systemctl stop mysqld
systemctl disable mysqld
lsof -i :3306
4,配置web02的wp-config.php
[root@web02 /application/nginx/html/WordPress]# vim wp-config.php
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'wordpress' );
/** MySQL database password */
define( 'DB_PASSWORD', 'oldboy123' );
/** MySQL hostname */
define( 'DB_HOST', '172.16.1.51' );? ?#DB01的ip
5猜惋,在DB01解壓web02傳過來的數(shù)據(jù)庫:
[root@db01 ~]# cd /tmp
[root@db01 /tmp]# gzip -d web02_db.sql.gz
[root@db01 /tmp]# mysql </tmp/web02_db.sql
grant all privileges on wordpress.* to wordpress@'172.16.1.%' identified by 'oldboy123';
flush privileges;
select user,authentication_string,host from mysql.user;