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

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

问题描述

我有一个工作的本地Drupal 7站点(使用本地MySQL数据库),但现在我正在将其迁移到Amazon Web Services(目前正在运行测试Drupal站点)。我将所有的drupal文件放在EC2实例服务器上的一个目录 mydrupalite 中,数据库已被添加到远程MySQL中,但是我现在不知道该怎么做为了配置apache来显示新网站。



我迄今为止所尝试的:




  • 我在 / etc / apche2 / sites-available 中添加了该文件(复制旧实例并在适当的情况下更改了目录名称)

  • 我在 / etc / apache2 / sites-enabled 中更改了符号链接(删除旧的符号链接并添加了一个新符号链接),以便只有新文件被指向然后我重新启动服务器并导航到该站点,但是它带我到安装页面(就好像我重新开始)

  • ul>

    以下是本机上设置文件中$ databases变量的内容(用户名已更改,但pw为空字符串)

      if(!isset($ databases)){
    $ databases = arr AY();
    }

    $ databases ['default'] ['default'] = array(
    'driver'=>'mysql',
    'database'= >'naicdrpl',
    'username'=>'mylocalsiteusername',
    'password'=>'',// password是一个空字符串
    'host'=> '127.0.0.1',
    'port'=> 33067);


    解决方案

    您可以使用备份和迁移模块进行迁移。这很容易使用。


    1. 从Drupal目录中压缩所有文件。在新服务器上复制/解压缩该文件。

    2. 使用备份&迁移模块备份数据库。

    3. 在新服务器上安装Drupal站点。运行install.php并按照步骤 - 您应该可以更改 /sites/default/settings.php文件中的设置

    4. 继续 / admin / modules 并启用备份和迁移。

    5. 继续 / admin / config / system / backup_migrate / restore 上传您的备份文件,然后单击还原按钮

    注1(数据库设置):



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

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

    $ databases ['default'] ['default'] = array(
    'driver'=>'mysql',
    'database'= >'nameofyourDB',//这里输入新的空数据库的名称
    'username'=>'mylocalsiteDBusername',//这里输入数据库用户的用户名
    'password'=> 'yourpassword',//您应该始终为数据库用户设置密码
    'host'=>'127.0.0.1',//您的主机名(通常是localhost)
    '端口'=> 33067); //默认MySql端口

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



    注2(settings.php文件提交):



    迁移时站点和(在你的情况下用新的替换旧的)你想要更改settings.php文件可能会有一些问题的写入权限的settings.php文件。这是一种常见的情况,默认情况下,您无法更改settings.php,以便编辑/替换该文件,您需要更改文件的权限以及更改该文件的文件夹的权限。没有写权限,你可以得到新的站点和旧的settings.php文件(您迁移的站点的settings.php文件将不会覆盖旧文件)。



    希望这有助于。


    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:

    • 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)

    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 );
    

    解决方案

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

    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

    NOTE 1 (database settings):

    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
    

    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.

    NOTE 2 (settings.php file premissions):

    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).

    Hope this helps.

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

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