Ubuntu上wordpress网站迁移到AWS EC2服务器


  • 进入原网站的phpmyadmin,备份mysql,

    dormant1_wordpress.sql.gz

  • 备份wordpress的目录,dormanthink.com
  • 在EC2上新建一个用户,

    sudo useradd -mr r_username

    sudo passwd r_username

    密码为: 456789xxx

    给予权限,

    sudo nano /etc/sudoers

    加入如下行,

    r_username ALL=(ALL:ALL) ALL

    修改r_usernameshell

    sudo nano /etc/passwd

    找到r_username那一行修改最后面的/bin/sh/bin/bash

    之后就可以用这个用户名登陆ftp服务器了。最好将匿名也打开。

  • 在EC2上安装ftp server

    先打开21端口。

    安装vsftp

    sudo apt-get install vsftpd

    配置vsftp

    sudo nano /etc/vsftpd.conf

    修改如下行

    将write_enable=yes前面的#去掉。那么ftp server就安装成功了。

    #禁止匿名访问

    anonymous_enable=YES

    #允许本地帐户访问

    local_enable=YES

    #允许写入(上传)

    write_enable=YES

    local_umask=022

    重启vsftp服务.

  • 将文件上传到服务器上。之后关闭AWS的2120端口。
  • 解压缩文件,并将文件复制为/var/www/blog.dormanthink.com
  • 登录新服务器的phpmyadmin,新建用户,名为druculac,密码456789,

    新建一个数据库wordpress,名字跟原先的数据库要相同。

    编辑wordpress的配置文件如下,sudo nano /var/www/blog.dormanthink.com/wp-config.php

    修改如下:数据库名,用户名和密码。

    修改wordpress目录权限,sudo chmod 777 -R /var/www/blog.dormanthink.com/

  • 导入数据库备份,

    先修改数据库备份的名字为wordpress.sql

    mysql -u druculac -p

    use wordpress

    source wordpress.sql

    在phpmyadmin中查看,确认已经导入了数据库了。

  • 修改apache2的配置。

    sudo cp 000-default.conf blog.dormanthink.com.conf

    修改ServerName和目录

    sudo nano blog.dormanthink.com.conf

    使能这个网站。

    sudo a2ensite blog.dormanthink.com.conf

     
     

  • 验证迁移。修改hosts文件,将dns解析到新的地址。

    并重新打开浏览器验证。http://blog.dormanthink.com

    用户名和密码还是跟以前一样。

Over~

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

Ubuntu上wordpress网站迁移到AWS EC2服务器 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐


首先在虾米电台中找到自己虾米电台的播放地址,如下:

http://www.xiami.com/res/fm/xiamiRadio_20120612.swf

然后在外观->小工具(widget)里面,在footer的位置添加一个文本,标题随意,文本内容如下:

此时刷新主页,发现最下面的虾米电台显示不完整,width被限制在一个很窄的尺度了。下面修改css
在主题的编辑中找到styll.css,查找widgets-wrap-footer这一段,进行修改,如下红色:

#widgets-wrap-footer {
overflow: hidden;
padding-bottom: 10px;
color: #FFF;
}
.widget-footer {
float: left;
margin-top: 10px;
margin-left: 8px;
margin-bottom: 6px;
width: 640px;
overflow: hidden;
}

其实这里的width和第二段代码中的width差不多就行了,根据喜好自己调整。

这个做完了之后,仅仅只有一个虾米电台的播放器,如果想把自己虾米猜完整的网页做进来,就把src后面的改为

http://www.xiami.com/radio/play/type/4/oid/109765

这样就可以收藏成为自己帐号下面的音乐了。

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

在wordpress中添加虾米电台的背景音乐 was originally published on DormanThink

修改mysql上传的最大限制


方法一:修改php.ini文件里面的upload_max_filesize = 2M, memory_limit = 128M; post_max_size = 8M,后面两个参数要大于第一个参数。重启apache即可

 

方法二:将*.sql文件上传到ftp上,然后用命令行来执行导入操作。

mysql –u root –p

use database_name

source *.sql

over~

修改mysql上传的最大限制 was originally published on DormanThink

修改mysql上传的最大限制 was originally published on DormanThink

修改mysql上传的最大限制 was originally published on DormanThink

修改mysql上传的最大限制 was originally published on DormanThink

修改mysql上传的最大限制 was originally published on DormanThink

修改mysql上传的最大限制 was originally published on DormanThink

修改mysql上传的最大限制 was originally published on DormanThink

修改mysql上传的最大限制 was originally published on DormanThink

wordpress网站换新域名


将dormanthink.com的域名换成dormanthink.com。

  1. 解除.com的解析,换成.net的解析
  2. 用phpmyadmin进入数据库的后台,用搜索功能,选中所有表搜索dormanthink.com
  3. 找到有哪些表的哪些列中含有dormanthink.com,并记下来
  4. 在SQL标签卡中执行以下语句

    UPDATE 表名 SET 列名 = replace(列名, ‘dormanthink.com’, ‘dormanthink.com’);

    举例如下

    UPDATE wp_options SET option_value = replace(option_value, ‘dormanthink.com’, ‘dormanthink.com’);

  5. 可以一次性将所有替换。

     

    大功告成~~

<

p class=”wp-crosspost-linkback”>wordpress网站换新域名 was originally published on DormanThink

wordpress网站换新域名 was originally published on DormanThink

wordpress网站换新域名 was originally published on DormanThink

wordpress网站换新域名 was originally published on DormanThink

wordpress网站换新域名 was originally published on DormanThink

wordpress网站换新域名 was originally published on DormanThink

wordpress网站换新域名 was originally published on DormanThink