wordpress 服务器

One way to speed up your website development is to build your website locally on your own computer using a software like WAMP (for Windows) or MAMP (for Mac).

一种加快网站开发速度的方法是使用WAMP (对于Windows)或MAMP (对于Mac)之类的软件在自己的计算机上本地构建网站。

Once you’re finished perfecting your website, the next step is to move it from your computer to a live site and share your creation with the world. In this article, we will show you how to easily move WordPress from local server to a live site.

完成网站的完善后,下一步就是将其从计算机移至实时网站,并与世界分享您的创作。 在本文中,我们将向您展示如何轻松地将WordPress从本地服务器移动到实时站点。

We will cover two different methods to move WordPress from local server to your live website (step by step).

我们将介绍两种将WordPress从本地服务器移动到您的实时网站的不同方法(逐步)。

The first method uses a WordPress migration plugin and is recommended for beginners. In the second method, we will show you how to manually move WordPress from local server to a live site.

第一种方法使用WordPress迁移插件,建议初学者使用。 在第二种方法中,我们将向您展示如何将WordPress从本地服务器手动移动到实时站点。

You can choose the method that best suits you:

您可以选择最适合您的方法:

  • Method 1. Move WordPress from local server to live site using a plugin方法1.使用插件将WordPress从本地服务器移动到实时站点
  • Method 2. Manually move WordPress from local server to live site方法2。手动将WordPress从本地服务器移动到实时站点

在你开始之前 (Before You Begin)

In order for you to migrate WordPress from localhost to live server, you need to have a few things in place.

为了使WordPress从localhost迁移到实时服务器,您需要准备一些东西。

First, we’re assuming that you have a WordPress site running on local server (also called localhost) on your computer, and you have full access to it.

首先,我们假设您在计算机上的本地服务器(也称为localhost)上运行了一个WordPress站点,并且可以完全访问它。

Next, you’ll need to have a domain name and web hosting. We have a list of the best WordPress hosting companies that you can choose from.

接下来,您将需要一个域名和虚拟主机。 我们列出了最好的WordPress托管公司 ,您可以从中选择。

To speed it up, you can use Bluehost. They’re an official WordPress recommended hosting provider, and they are offering our users an exclusive 60% off discount + a free domain.

要加快速度,可以使用Bluehost 。 他们是WordPress官方推荐的托管服务提供商,并且为我们的用户提供60%的折扣和免费域名。

If you need help setting up your website, follow our step by step guide on how to make a website.

如果您在建立网站方面需要帮助,请按照有关如何制作网站的分步指南进行操作 。

Finally, you will need to have a FTP program and know how to use FTP, so you can upload your content to the live site.

最后,您将需要一个FTP程序并知道如何使用FTP ,以便可以将内容上载到实时站点。

Ready? Let’s begin migrating your WordPress site.

准备? 让我们开始迁移您的WordPress网站。

方法1.使用迁移插件将WordPress从本地服务器转移到实时站点 (Method 1. Transfer WordPress from Local Server to Live Site Using a Migration Plugin)

This method is easier and recommended for beginners. We’ll be using a WordPress migration plugin to move WordPress from localhost to a live site.

这种方法比较简单,建议初学者使用。 我们将使用WordPress迁移插件将WordPress从localhost移至实时站点。

步骤1.安装和设置复制器插件 (Step 1. Install and Setup Duplicator Plugin)

First, thing you need to do is install and activate the Duplicator plugin on your local site. For more details, see our step by step guide on how to install a WordPress plugin.

首先,您需要做的是在本地站点上安装并激活Duplicator插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to go to Duplicator » Packages page and click on the ‘Create New’ button.

激活后,您需要进入Duplicator»软件包页面,然后单击“新建”按钮。

After that, click on the next button to continue.

之后,单击下一步按钮继续。

Duplicator will now run some tests to see if everything is in order. If all items are marked ‘Good’ then click on the ‘Build’ button.

现在,Duplicator将运行一些测试以查看是否一切正常。 如果所有项目都标记为“良好”,则单击“构建”按钮。

This process may take a few minutes depending on the size of your website. You need to leave this tab open until the process is complete.

此过程可能需要几分钟,具体取决于您网站的大小。 您需要将此选项卡保持打开状态,直到该过程完成。

Once finished, you’ll see download options for Installer and the Archive package. You need to click on the ‘One click download’ link to download both files to your computer.

完成后,您将看到Installer和Archive软件包的下载选项。 您需要点击“一键下载”链接,将两个文件都下载到您的计算机上。

So what are these files?

那么这些文件是什么?

Well, the archive file is a copy of your complete WordPress website. It includes all WordPress core files as well as your images, uploads, themes, plugins, and a backup of your WordPress database.

好吧,存档文件是您完整的WordPress网站的副本。 它包括所有WordPress核心文件以及您的图像,上载,主题,插件以及WordPress数据库的备份。

The installer file is a script that will automate the migration by unpacking the archive file.

安装程序文件是一个脚本,它将通过解压缩存档文件来自动进行迁移。

步骤2.为您的实时站点创建数据库 (Step 2. Create a Database for Your Live Site)

Before you can run the installer or upload the WordPress website from localhost to your hosting server, you will need to create a MySQL database for your live website.

在运行安装程序或将WordPress网站从localhost上传到托管服务器之前,您需要为实时网站创建一个MySQL数据库。

If you have already created a MySQL database, then you can skip this step.

如果已经创建了MySQL数据库,则可以跳过此步骤。

To create a database you need to visit your hosting account’s cPanel dashboard. Scroll down to the Databases section and then click on the MySQL Databases icon.

要创建数据库,您需要访问托管帐户的cPanel仪表板。 向下滚动到“数据库”部分,然后单击“ MySQL数据库”图标。

On the next screen, you’ll see a field to create a new database. Simply provide a name for your database and click on the ‘Create Database’ button.

在下一个屏幕上,您将看到一个用于创建新数据库的字段。 只需为您的数据库提供一个名称,然后单击“创建数据库”按钮。

cPanel will now create a new database for you. After that, you need to scroll down to the MySQL Users section.

cPanel现在将为您创建一个新的数据库。 之后,您需要向下滚动到“ MySQL用户”部分。

Next, provide a username and password for your new user and click on the ‘Create a user’ button.

接下来,为您的新用户提供用户名和密码,然后单击“创建用户”按钮。

The new user you just created, still does not have permission to work on the database. Let’s change that.

您刚刚创建的新用户仍然没有权限在数据库上工作。 让我们改变它。

Scroll down to the ‘Add User to Database’ section. Simply select the database user you created from the dropdown menu next to the ‘User’ field, then select the database, and click on the add button.

向下滚动到“将用户添加到数据库”部分。 只需从“用户”字段旁边的下拉菜单中选择您创建的数据库用户,然后选择数据库,然后单击添加按钮。

Your database is now ready to be used with your WordPress site. Make sure to note down the database name, username, and password. You’ll need this information in the next step.

您的数据库现在可以与WordPress网站一起使用了。 确保记下数据库名称,用户名和密码。 下一步将需要此信息。

步骤3.,将文件从本地服务器上传到实时站点 (Step 3. Upload Files from Local Server to Live Site)

Now you need to upload the archive and installer files from your local site to your hosting account.

现在,您需要将存档和安装程序文件从本地站点上载到托管帐户。

First, connect to your live site using an FTP client. Once connected, make sure that the root directory of your website is completely empty.

首先,使用FTP客户端连接到您的实时站点。 连接后,请确保网站的根目录完全为空。

Normally, root directory is the /home/public_html/ folder.

通常,根目录是/ home / public_html /文件夹。

Some WordPress hosting companies automatically install WordPress when you sign up. If you have WordPress files there, then you need to delete them.

一些WordPress托管公司在您注册时会自动安装WordPress 。 如果那里有WordPress文件,则需要删除它们。

After that, you can upload the archive and installer files from Duplicator to your empty root directory.

之后,您可以将归档文件和安装程序文件从Duplicator上传到空的根目录。

步骤4.运行迁移脚本 (Step 4. Runing The Migration Script)

After you have uploaded the migration files, you need to visit the following URL in your browser:

上载迁移文件后,需要在浏览器中访问以下URL:

http://example.com/installer.php

http://example.com/installer.php

Don’t forget to replace example.com with your own domain name.

不要忘记用您自己的域名替换example.com。

This will launch the Duplicator migration wizard.

这将启动Duplicator迁移向导。

The installer will automatically scan for the archive file and run a validation test. You need to check the terms & conditions checkbox and continue by clicking on the Next button.

安装程序将自动扫描存档文件并运行验证测试。 您需要选中条款和条件复选框,然后单击下一步按钮继续。

On the next screen, it will ask you to enter your WordPress database information.

在下一个屏幕上,它将要求您输入WordPress数据库信息。

Your host will likely be localhost. After that, you will enter the details of the database you created in the earlier step.

您的主机可能是本地主机。 之后,您将输入在上一步中创建的数据库的详细信息。

Click on the next button to continue.

单击下一步按钮继续。

Duplicator will now import your WordPress database backup from the archive into your new database.

现在,Duplicator将把您的WordPress数据库备份从存档导入到新数据库中。

Next, it will ask you to update site URL or Path. You shouldn’t have to change anything since it automatically detects the URL of your live website, and its path.

接下来,它将要求您更新站点URL或路径。 您无需更改任何内容,因为它会自动检测您的实时网站的URL及其路径。

Click on the next button to continue.

单击下一步按钮继续。

Duplicator will now finish the migration and will show you a success screen. You can now click on the ‘Admin Login’ button to enter the WordPress admin area of your live site.

现在,Duplicator将完成迁移并显示成功屏幕。 现在,您可以单击“管理员登录”按钮,进入实时站点的WordPress管理区域。

Once you login to your live site, Duplicator will automatically clean up the installation files.

登录实时站点后,Duplicator将自动清理安装文件。

That’s all, you have successfully moved WordPress from local server to your live site.

就是这样,您已经成功将WordPress从本地服务器移到了您的实时站点。

方法2。手动将WordPress从本地服务器传输到实时站点 (Method 2. Manually Transfer WordPress from Local Server to Live Site)

In this method, we will show you how to manually move WordPress from local server to your live site. It will come in handy if the first method doesn’t work or you prefer to do it manually.

通过这种方法,我们将向您展示如何将WordPress从本地服务器手动移动到您的活动站点。 如果第一种方法不起作用或您希望手动进行操作,它将很方便。

步骤1:导出本地WordPress数据库 (Step 1: Export Local WordPress Database)

The first thing you need to do is export your local WordPress database. We’ll be using phpMyAdmin to do that. If you are unfamiliar with it, then you might want to take a look at our guide to WordPress database management using phpMyAdmin.

您需要做的第一件事是导出本地WordPress数据库。 我们将使用phpMyAdmin来做到这一点。 如果您不熟悉它,那么您可能需要看一下我们使用phpMyAdmin进行WordPress数据库管理的指南。

Simply go to http://localhost/phpmyadmin/ and click on your WordPress database. Next, click on the Export button from the top menu bar.

只需转到http://localhost/phpmyadmin/并单击您的WordPress数据库。 接下来,单击顶部菜单栏中的“ 导出”按钮。

In the Export Method option, you can choose “Quick” or “Custom”. Custom will provide you with more options to export your database.

在“ 导出方法”选项中,可以选择“快速”或“自定义”。 自定义将为您提供更多导出数据库的选项。

We recommend choosing Quick, and then click the Go button to download your database.

我们建议选择“快速”,然后单击“执行按钮以下载数据库。

第2步:将WordPress文件上传到实时网站 (Step 2: Upload WordPress Files to Live Site)

Now we’ll need to move all your website files to the live site.

现在,我们需要将您的所有网站文件移至实时网站。

To get started, go ahead and open your FTP client and connect to your web hosting account.

首先,请打开您的FTP客户端并连接到您的虚拟主机帐户。

Once you’re connected to your live site, make sure you upload the files in the right directory. For example, if you want the site to be hosted on yoursite.com, then you would want to upload all the files in your public_html directory.

连接到实时站点后,请确保将文件上传到正确的目录中。 例如,如果您希望将站点托管在yoursite.com上,则需要上载public_html目录中的所有文件。

Now select your local WordPress files and upload them to your live server.

现在,选择您的本地WordPress文件并将其上传到实时服务器。

步骤3:在实时站点上创建MySQL数据库 (Step 3: Create MySQL Database on Live Site)

While your FTP client is uploading your WordPress files, you can start importing your database to the live server. Most WordPress hosting providers offer cPanel to manage your hosting account, so we’ll show you how to create a database using cPanel.

当FTP客户端上载WordPress文件时,您可以开始将数据库导入实时服务器。 大多数WordPress托管服务提供商都提供cPanel来管理您的托管帐户,因此我们将向您展示如何使用cPanel创建数据库。

First, you need to log in to your cPanel dashboard and click on the MySQL Databases icon which can be found in the databases section.

首先,您需要登录到cPanel仪表板,然后单击“数据库”部分中的“ MySQL数据库”图标。

On the next screen, create a database by entering a name for your database and clicking the Create Database button.

在下一个屏幕上,通过输入数据库名称并单击“ 创建数据库”按钮来创建数据库

After creating your database, scroll down to the MySQL Users section and create or add an existing user to the database.

创建数据库后,向下滚动至“ MySQL用户”部分,然后将现有用户创建或添加到数据库中。

After adding the user, cPanel will take you to set MySQL privileges for that user. Simply grant all privileges to the user by making sure every box is checked, and then click the Make Changes button.

添加用户后,cPanel将带您为该用户设置MySQL特权。 只需确保选中每个框,然后向用户授予所有特权,然后单击“进行更改”按钮即可。

步骤4:在实时网站上导入WordPress数据库 (Step 4: Import WordPress Database on Live Site)

The next step in the process is to import your WordPress database.

该过程的下一步是导入WordPress数据库。

Go to your cPanel dashboard, scroll down to the databases section and click on phpMyAdmin.

转到cPanel仪表板,向下滚动到“数据库”部分,然后单击phpMyAdmin

This will take you to phpMyAdmin where you want to click on the database you created in Step 3. PhpMyAdmin will show your new database with no tables.

这将带您到phpMyAdmin,您要在其中单击在步骤3中创建的数据库。PhpMyAdmin将显示没有表的新数据库。

Click on the Import tab in the top menu. On the import page, click on Choose File button and then select the database file you saved in Step 1.

单击顶部菜单中的导入选项卡。 在导入页面上,单击“ 选择文件”按钮,然后选择在步骤1中保存的数据库文件。

Lastly, press the Go button at the bottom of the page. PhpMyadmin will now import your WordPress database.

最后,按页面底部的“执行按钮。 现在,PhpMyadmin将导入您的WordPress数据库。

步骤5:更改网站网址 (Step 5: Change the Site URL)

Now you need to change the site URL in your database, so that it will connect with your live WordPress site.

现在,您需要更改数据库中的站点URL,以便它将与您的实时WordPress网站连接。

In phpMyAdmin, look for the wp_options table in your database that we just imported in step 4. If you changed your database prefix, then instead of wp_options it might be {prefix}_options.

在phpMyAdmin中,在我们刚刚在步骤4中导入的数据库中查找wp_options表。如果更改了数据库前缀 ,那么它可能是{prefix} _options而不是wp_options。

Click on the Browse button next to wp_options or the link that you see in the sidebar to open the page with a list of fields within the wp_options table. See screenshot below:

单击wp_options旁的浏览按钮或在侧栏中看到的链接,以打开包含wp_options表中字段列表的页面。 参见下面的截图:

Under the field options_name, you need to look for siteurl. Click the Edit Field icon which can be found at the far left at the beginning of the row.

options_name字段下,您需要查找siteurl 。 单击“编辑字段”图标,该图标位于行开头的最左侧。

When you click the edit field, an edit field window will appear. In the input box for option_value, you will see the URL of your local install probably something like: http://localhost/test. Carefully insert your new site url in this field, for example: https://www.wpbeginner.com

当您单击编辑字段时,将出现一个编辑字段窗口。 在option_value的输入框中,您将看到本地安装的URL,可能类似于: http://localhost/test 。 在此字段中小心插入新站点的URL,例如: https://www.wpbeginner.com : https://www.wpbeginner.com

Save the field by clicking the Go button.

单击“执行按钮保存字段。

Next, you need to replicate this step for the option name: home. The wp_options page can be a few pages long, so simply find the home tab.

接下来,您需要为选项名称复制此步骤: home 。 wp_options页可以长几页,因此只需找到home选项卡即可。

Usually it is on the second page which you can navigate to by clicking on the pagination arrows in phpMyAdmin.

通常它在第二页上,您可以通过单击phpMyAdmin中的分页箭头导航到。

Update the home url to be the same as your siteurl.

更新的主页网址是一样的SITEURL。

步骤6:设定现场网站 (Step 6: Setup Your Live Site)

Now that we have imported the database and all of our content should be uploaded, it’s time to configure WordPress.

现在我们已经导入了数据库并且所有内容都应该上传了,是时候配置WordPress了。

At this time, your site should be showing an Error Establishing Database Connection error.

这时,您的站点应该显示“ 建立数据库连接错误”错误。

To fix this, connect to your website using an FTP client and edit wp-config.php file.

要解决此问题,请使用FTP客户端连接到您的网站,然后编辑wp-config.php文件。

You will need to provide the database name, user and password you created earlier in Step 3.

您将需要提供先前在步骤3中创建的数据库名称,用户和密码。

Next, save the wp-config.php file and upload it back to your server.

接下来,保存wp-config.php文件并将其上传回您的服务器。

You can now visit your website, and it should be live now.

您现在可以访问您的网站,并且该网站现在应该可以上线了。

Next, you need to login to your WordPress admin panel and go to Settings » General. Without changing anything, scroll to the bottom and click the Save Changes button.

接下来,您需要登录到WordPress管理面板,然后转到“设置”»“常规” 。 不做任何更改,滚动到底部,然后单击“ 保存更改”按钮。

This will ensure that the site URL is corrected anywhere else that it needs to be.

这将确保在其他任何需要纠正的地方都纠正该网站的URL。

After that go to Settings » Permalink and click Save Changes to ensure that all post links are working fine.

之后,转到“设置”»“永久链接” ,然后单击“ 保存更改”以确保所有帖子链接均正常运行。

步骤7:通过更新路径来修复图像和断开的链接 (Step 7: Fix Images and Broken Links by Updating Paths)

Whenever you are moving a WordPress site from one domain to another, or from local server to a live site, you’ll face broken links and missing images.

每当将WordPress网站从一个域移动到另一个域 ,或从本地服务器移动到实时站点时,您都​​将面临断开的链接和丢失的图像。

You can either use the SQL query or use the Velvet Blues WordPress plugin.

您可以使用SQL查询或使用Velvet Blues WordPress插件 。

For those who want to do it via SQL, here is a simple SQL query that should solve this problem:

对于那些想通过SQL进行操作的人,下面是一个可以解决此问题的简单SQL查询:


UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.yourlivesite.com/');

Simply go to phpMyAdmin, click on your database and then click on SQL from top menu. Write this query, but don’t forget to change it with your own local site and live site URLs.

只需转到phpMyAdmin,单击您的数据库,然后从顶部菜单中单击SQL。 编写此查询,但不要忘记使用您自己的本地站点和实时站点URL进行更改。

That’s all, you have successfully migrated WordPress from localserver to a live site!

就是这样,您已经成功将WordPress从localserver迁移到了实时站点!

Hopefully now your live website is up and running smoothly. Be sure to check out your website to make sure that everything is working as expected. If you notice any errors, you can check out our guide to common WordPress errors for help troubleshooting.

希望现在您的实时网站正常运行。 请务必检查您的网站,以确保一切正常。 如果发现任何错误,可以查看我们的WordPress常见错误指南,以帮助进行故障排除。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-move-wordpress-from-local-server-to-live-site/

wordpress 服务器

wordpress 服务器_如何将WordPress从本地服务器移动到实时站点(2种方法)相关推荐

  1. wordpress创建_如何在WordPress中轻松创建优惠券网站

    wordpress创建 Are you looking to create a coupon site with WordPress? We often get asked about how did ...

  2. wordpress用户注册_比较了WordPress用户的5个托管服务提供商

    wordpress用户注册 This article is part of a series created in partnership with SiteGround. Thank you for ...

  3. wordpress创建_如何创建WordPress儿童主题

    wordpress创建 I have been blogging for a long time now and I use WordPress in all my blogs. Its easy t ...

  4. wordpress 数据库_如何在WordPress中创建视频库(逐步)

    wordpress 数据库 Recently, a user asked us how to create a video gallery in WordPress. WordPress makes ...

  5. wordpress创建_您可以使用WordPress创建的19种网站类型

    wordpress创建 When people are deciding why they should use WordPress, we often get asked about "c ...

  6. wordpress主题_这些顶级WordPress主题可以使2018年成为有史以来最好的一年

    wordpress主题 This article was sponsored by BAWMedia. Thank you for supporting the partners who make S ...

  7. wordpress 邮件_停止在WordPress中使用一次性电子邮件地址

    wordpress 邮件 Spammers are everywhere, they use automated software that crawls the web in search of w ...

  8. wordpress用户注册_如何在WordPress网站上允许用户注册

    wordpress用户注册 Do you want to allow users to register on your site? You can enable user registration ...

  9. wordpress创建_如何在WordPress中创建子页面

    wordpress创建 Do you want to create a child page on your site? Pages in WordPress can be standalone or ...

最新文章

  1. 李彦宏:AI模仿人脑是走不通的
  2. python申请内存函数_python进阶用法2 【从帮助函数看python内存申请机制】
  3. 【问题记录】服务器部署项目时启动tomcat后报错 HTTP 错误 404.0- Not Found 您要找的资源已被删除、已更名或暂时不可用 解决方案···
  4. CIA公布了收集和存储美国公民信息的新规则
  5. QT调用dll且进入DLL src code调试
  6. linux 间隔定时器,Linux间隔定时器的使用 探索一
  7. python画猪头_使用Python画小猪佩奇 社会人标配
  8. 通过curl访问openstack各服务
  9. Markdown的常用使用语法
  10. 关于CDC在非控件类中的使用
  11. 21幅非常有创意的倒影摄影作品欣赏
  12. 【2017-2018 ACM-ICPC, Central Europe Regional Contest (CERC 17)】Justified Jungle【树上思维题】
  13. 微信小程序获取位置信息
  14. tar打包命令(linux)
  15. H3C认证路由交换网络高级工程师H3CSE
  16. Linux 误删文件后恢复文件
  17. WPS打开文档时显示“文档被其他程序占用,是否以只读的方式”打开解决方法
  18. 父子组件传值之(子传父)
  19. bzoj1933: [Shoi2007]Bookcase 书柜的尺寸
  20. 万能种子搜索器p2p官方版

热门文章

  1. Ubuntu18.04 Sogou搜狗输入法选词面板乱码Bug终极Solution
  2. 使用openCV进行边缘检测、二值化、轮廓、轮廓检测、BGR、灰度图、二值化,专栏:各种openCV实践的案例
  3. 如何用c语言添加背景图片,如何实现在单文档的窗口背景上贴上图片?
  4. 幸运岛链LKC:打造全新的商业和经济体系,让区块链赋能商业经济
  5. 为何excel中数据无法计算机,造成Excel表格打不开的几种原因及解决办法
  6. labview中前面板如何设置背景图片
  7. 机械原理习题-(附答案)
  8. Qt例子学习笔记 - Examples/Qt-6.2.0/charts/callout
  9. 第四章(1.2)机器学习——在web攻击检测中的应用实践
  10. vivo手机怎么添加日程提醒?vivo手机添加日程方法