如何将 Drupal 站点迁移到 Amazon Web Services EC2? [英] How can I migrate a Drupal site to Amazon Web Services EC2?

查看:26
本文介绍了如何将 Drupal 站点迁移到 Amazon Web Services EC2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可用的本地 Drupal 7 站点(带有本地 MySQL 数据库),但现在我正尝试将其迁移到 Amazon Web Services(该站点当前正在成功运行测试 Drupal 站点).我在 EC2 实例服务器上的目录 mydrupalsite 中有我的所有 drupal 文件,并且数据库已添加到远程 MySQL,但我现在不知道该怎么做才能将 apache 配置为显示新网站.

I have a working local Drupal 7 site (with local MySQL Database), but now I'm trying to migrate it to Amazon Web Services (which is currently running a test Drupal site successfully). I have all of my drupal files in a directory mydrupalsite on the EC2 instance server and the database has been added to the remote MySQL, but I don't know what to do now in order to configure apache to show the new site.

到目前为止我尝试过的:

What I have tried so far:

  • 我在 /etc/apche2/sites-available 中添加了文件(复制了旧实例并在适当的地方更改了目录名称)
  • 我更改了 /etc/apache2/sites-enabled 中的符号链接(删除了旧的符号链接并添加了一个新的符号链接),以便仅指向新文件.
  • 然后我重新启动了服务器并导航到该站点,但它带我进入了安装页面(就像我重新开始一样)
  • I added the file in /etc/apche2/sites-available (copied the old instance and changed the directory name where appropriate)
  • I changed the symlinks (deleted the old symlink and added a new one) in /etc/apache2/sites-enabled so that only the new file is pointed to.
  • Then I rebooted the server and navigated to the site, but it's taking me to the install page (as though i were starting over)

这是我本地机器上设置文件中$databases变量的内容(用户名已更改,但密码为空字符串)

Here are the contents of $databases variable in the settings file on my local machine (with username changed but the pw is an empty string)

if (!isset($databases)) {
  $databases = array();
}

$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'naicdrpl',
  'username' => 'mylocalsiteusername',
  'password' => '',    //    password is an empty string
  'host' => '127.0.0.1',
  'port' => 33067 );

推荐答案

您可以使用 backup&migrate 用于迁移的模块.使用起来非常方便.

You can use backup&migrate module for migration. It is very easy for using.

  1. 压缩 Drupal 目录中的所有文件.在新服务器上复制/解压缩该文件.
  2. 使用备份和迁移模块在文件中备份您的数据库.
  3. 在新服务器上安装 Drupal 站点.运行 install.php 并按照步骤操作 - 您可能应该更改 /sites/default/settings.php 文件 中的设置.
  4. 继续 /admin/modules 并启用备份和迁移.
  5. 继续/admin/config/system/backup_migrate/restore上传您的备份文件并点击恢复按钮
  1. Zip all files from your Drupal directory. Copy/unzip that file on new server.
  2. Backup your database in file with backup&migrate module.
  3. Install Drupal site on new server. Run install.php and follow steps - you should probably change settings in /sites/default/settings.php file.
  4. Go on /admin/modules and enable backup and migrate.
  5. Go on /admin/config/system/backup_migrate/restore upload your backup file and click restore button

注意 1(数据库设置):

对于 Drupal 安装,当然你需要有数据库.您应该只创建空数据库并为该数据库设置用户.您还应该为该数据库用户设置密码并授予他完全权限.然后在 settings.php 文件中更改该数据:

For Drupal installation of course you need to have database. You should just create empty DB and set up user for that database. You should also set up password for that DB user and give him full privileges. In settings.php file you then change that data:

if (!isset($databases)) {
  $databases = array();
}

$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'nameofyourDB', //here you enter name of new empty database
  'username' => 'mylocalsiteDBusername', //here you enter user name of database user
  'password' => 'yourpassword',    //you should always set up password for database user for security reasons
  'host' => '127.0.0.1', //name of your host (usually is localhost)
  'port' => 33067 ); //default MySql port

基本上在这里,您在新服务器上创建的空数据库上设置 Drupal 站点.之后,您使用备份和迁移模块填充该数据库.

Basically here you set up Drupal site on empty database you created on new server. After that you fill that database using backup and migrate module.

注意 2(settings.php 文件权限):

当您迁移站点并且(在您的情况下用新站点替换旧站点)要更改 settings.php 文件时,settings.php 文件的写入权限可能会出现一些问题.默认情况下,您无法更改 settings.php 是一种常见情况,因此为了编辑/替换该文件,您需要更改文件的权限以及放置此文件的文件夹的权限.如果没有写入权限,您可能会得到新站点和旧 settings.php 文件(您迁移的站点中的 settings.php 文件不会覆盖旧文件).

When you migrate site and (in your case replace old one with new) you want to change settings.php file there can be a little problem with write permissions of the settings.php file. It is a common case that by default you can't change settings.php so in order to edit/replace that file you need to change permissions of the file and also of the folders where this file is placed. With no write permissions you can end up with new site and old settings.php file (the settings.php file from site you migrate will not overwrite old file).

希望这会有所帮助.

这篇关于如何将 Drupal 站点迁移到 Amazon Web Services EC2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆