服务器部署sas_如何在阿里云SAS上部署WordPress网站

服务器部署sas

This article was created in partnership with Alibaba Cloud. Thank you for supporting the partners who make SitePoint possible.

本文是与阿里云合作创建的。 感谢您支持使SitePoint成为可能的合作伙伴。

When it comes to cloud hosting, Alibaba Cloud is a relatively new kid in town. We have gotten used to AWS and its plethora of options, Heroku, and Google’s cloud solutions, which all either come with a level of complexity, or a price that is relatively high for anything except demo applications, or both.

在云托管方面,阿里云是一个相对较新的孩子。 我们已经习惯了AWS及其众多选项,Heroku和Google的云解决方案,这些解决方案要么都具有一定的复杂性,要​​么对于演示应用程序以外的任何产品来说价格都相对较高,或者两者兼而有之。

Complexity in this area has lead to courses being taught and books being written about some of these solutions, like Amazon’s cloud.

该领域的复杂性导致人们教授有关这些解决方案的课程和书籍,例如亚马逊的云。

Developers know that all the time devoted to debugging, learning, and perfecting deployment is time not spent on developing the core solutions we are working to deploy.

开发人员知道,所有用于调试,学习和完善部署的时间都花在了开发我们正在部署的核心解决方案上。

When it comes to raw VPS solutions, DigitalOcean, Vultr, and Linode have been go-to vendors for some years now. Here, as well, there are tradeoffs: when one wants to deploy a high-level solution, like well-known Content Management Systems (such as Drupal or WordPress), or eCommerce solutions (such as Magento, WooCommerce, or OpenCart), they can choose a dedicated, specialized, high-profile managed hosting. These have pretty steep prices, and not much in terms of 100% dedicated resources. Alternatively one can go for a dedicated system. For one to have a guaranteed 4GB of RAM available for their web application, or guaranteed processor cores, an available system shell, or one wants to be able to switch server stack components versions, one has to go for a dedicated server or a VPS.

在原始VPS解决方案方面,DigitalOcean,Vultr和Linode成为供应商已有多年了。 同样,这里也存在一些折衷:当人们想要部署高级解决方案(例如著名的内容管理系统(例如Drupal或WordPress)或电子商务解决方案(例如Magento,WooCommerce或OpenCart)时,可以选择专用的,专业的,备受瞩目的托管主机。 这些具有相当高的价格,并且对于100%专用资源而言价格不高。 另一种选择是可以使用专用系统。 要使一个Web应用程序有保证的4GB RAM可用,或者有保证的处理器内核,可用的系统外壳,或者要能够切换服务器堆栈组件版本的用户,则必须购买专用服务器或VPS。

Shared hosting environments only go so far in terms of squeezing the last bits of performance out of your server, or choosing and optimizing components of the server stack. They don’t give you ultimate control of the hosting environment, and often deliver mediocre results.

共享主机环境仅在压缩服务器性能的最后部分,或者选择和优化服务器堆栈的组件方面发挥了重要作用。 它们不能使您对托管环境有最终的控制权,并且通常只能带来中等的结果。

The dedicated systems that we mentioned are often the best solution for high-performing systems, and projects that care about a tuned and polished web visitor experience. They tend to be relatively affordable, they guarantee server resources, if not the entire machine in data center, but… they put a demand on the developer, or sysadmin, to set things up. If these dedicated systems come with sysadmin time and care included, they are usually not very competitive on price.

我们提到的专用系统通常是高性能系统的最佳解决方案,而这些项目关注的是经过调整和完善的Web访问者体验。 它们往往价格相对合理,可以保证服务器资源,即使不是数据中心中的整个计算机,也可以保证……但他们要求开发人员或sysadmin进行设置。 如果这些专用系统附带了sysadmin时间和护理,则它们通常在价格上没有竞争力。

Non-managed VPS and dedicated server solutions have the best edge here, in terms of hosting costs. This is where companies like Digital Ocean, Vultr and similar hosts have blossomed. But these vendors require knowledge of Linux administration, and knowledge of the intricacies of server stacks, like LAMP, LEMP, and others.

就托管成本而言,非托管VPS和专用服务器解决方案在这里具有最佳优势。 这就是Digital Ocean,Vultr和类似主机之类的公司蓬勃发展的地方。 但是这些供应商需要Linux管理方面的知识,并需要复杂的服务器堆栈(如LAMP,LEMP等)的知识。

With dedicated solutions, one has to hire sysadmins and developers to set these things up. They need to install the latest version of PHP and all of its modules, then the database and the server (like Apache or Nginx), and then there is the setup of the virtual host, SSL, debugging and compatibility issues that arise, package issues, the list goes on…

使用专用的解决方案,必须聘请系统管理员和开发人员来进行设置。 他们需要安装最新版本PHP及其所有模块,然后安装数据库和服务器(如Apache或Nginx),然后安装虚拟主机,SSL,出现的调试和兼容性问题,软件包问题。 ,清单继续...

This makes dedicated hosting a non-trivial endeavor. This is where companies like Cloudways have found their niche.

这使得专用托管成为一项艰巨的任务。 这是像Cloudways这样的公司找到自己的利基的地方。

阿里云 (Alibaba Cloud)

And now there is Alibaba Cloud.

现在有阿里云。

Alibaba Cloud is an ambitious vendor which offers a comprehensive spectrum of services, from CDN, cloud-based database services, big data and analytics solutions, media streaming and IoT solutions, and shared web hosting or flexible VPS solutions.

阿里云是一家雄心勃勃的供应商,提供广泛的服务,包括CDN,基于云的数据库服务,大数据和分析解决方案,媒体流和IoT解决方案以及共享Web托管或灵活的VPS解决方案。

They boast their own proprietary virtualization solutions developed in-house, without the virtualization overhead, and with good resource isolation. A major known solution without the virtualization overhead so far has been OVZ, but it hasn’t provided such good resource isolation. This is why its competitor technologies, KVM and XEN, have fared somewhat better with the premium range of VPS providers.

他们拥有自己内部开发的专有虚拟化解决方案,没有虚拟化开销,并且具有良好的资源隔离性。 迄今为止,没有虚拟化开销的主要已知解决方案是OVZ,但是它没有提供如此好的资源隔离。 这就是为什么其竞争对手技术KVM和XEN在高端VPS提供商范围内表现更好的原因。

If Alibaba has indeed developed a solution with little-to-no resource overhead, but with excellent isolation, this will give them an edge on the VPS providers market.

如果阿里巴巴确实开发了几乎没有资源开销但具有出色隔离性的解决方案,那么这将使他们在VPS提供商市场上占据优势。

One of Alibaba products is SAS – Simple Application Server. Since SAS builds on ECS architecture, it takes advantage of the aforementioned virtualization solutions.

SAS –简单应用服务器是阿里巴巴的产品之一。 由于SAS基于ECS体系结构,因此可以利用上述虚拟化解决方案。

Simple Application Server use the ECS I/O-optimized shared instances with CPUs, memory, operating systems, network, disks, and other services necessary to build a server.

Simple Application Server使用ECS I / O优化的共享实例以及构建服务器所需的CPU,内存,操作系统,网络,磁盘和其他服务。

Each user can have up to five SAS instances running.

每个用户最多可以运行五个SAS实例 。

Its goal is to find the sweet spot in servicing exactly the customers we described above – those who need price-competitive hosting solutions which offer control of the environment and a guarantee of resources.

它的目标是找到准确地为上述客户服务的最佳地点-那些需要具有价格竞争力的托管解决方案的客户,这些解决方案必须能够控制环境并保证资源。

部署简单 (Simplicity of Deployment)

What the SAS solution boasts is the ability for everyone to launch their web application within minutes – from Alibaba’s web management platform, without the need to set everything up – or even to log into the system’s shell.

SAS解决方案所具有的优势是,每个人都可以在几分钟内从阿里巴巴的Web管理平台启动其Web应用程序 ,而无需进行所有设置,甚至无需登录系统外壳即可。

This is not something that established VPS vendors can boast about, for the most part.

在大多数情况下,这不是老牌VPS供应商所能吹嘘的东西。

We have tried this, and it took us a mere couple of minutes from logging into our Alibaba account to actually seeing our website live and running.

我们已经进行了尝试, 从登录到阿里巴巴帐户到实际看到我们的网站运行起来仅花了几分钟

The process is painless and straightforward.

这个过程是轻松而直接的。

When we register for Alibaba Cloud here, we are presented with its free credit offer – Alibaba gives $300 of credit to new users. We can use it for the purpose of this tutorial – deploying a WordPress website on Simple Application Server. After we confirm our payment method, such as a credit card or PayPal, we get our starting credit activated, and we are good to go!

当我们在这里注册阿里云时 ,我们将获得其免费信贷优惠-阿里巴巴将为新用户提供300美元的信贷。 在本教程中,我们可以使用它-在Simple Application Server上部署WordPress网站。 确认我们的付款方式(例如信用卡或PayPal)后,我们将启动我们的初始信用额,我们一切顺利!

Now we can log into our management console, and select Simple Application Server in the left sidebar, among the Base services. When we are there, we can click “Create Server” button in the upper right corner, and we will be presented with options for selecting the server location – EU, US and Asia locations are available.

现在,我们可以登录到管理控制台,然后在基本服务中的左侧边栏中选择Simple Application Server。 当我们在那里时,我们可以单击右上角的“创建服务器”按钮,然后将为您提供选择服务器位置的选项-可以使用欧盟,美国和亚洲位置。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第1张图片

We can then select one of the prebuilt available images — apps or OS images are available (different Linux and Windows versions). For this guide, we selected the WordPress app image.

然后,我们可以选择一个预构建的可用映像之一-应用程序或OS映像可用(不同的Linux和Windows版本)。 在本指南中,我们选择了WordPress应用程序图像。

We then select the instance plan. These plans have different hardware resources available and payment plans, including monthly, quarterly, six monthly payment plan, annually and so on.

然后,我们选择实例计划。 这些计划具有不同的可用硬件资源和付款计划,包括每月,每季度,六个月的付款计划,每年等等。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第2张图片

Plans available range from 0.5 to 8 GB of RAM, 1 or 2 CPU cores, and all come with SSD storage, from 20 to 80GB. Those in need of more flexibility have other solutions available that are somewhat lower-level, but offer more control, like ECS.

可用的计划范围是0.5到8 GB的RAM,1或2个CPU内核,并且都带有20到80GB的SSD存储。 那些需要更大灵活性的用户可以使用其他解决方案,这些解决方案的级别较低,但是可以提供更多控制,例如ECS 。

After we pay, we can go to the management console for our SAS instance, which will take a couple of minutes to be deployed.

付款后,我们可以转到SAS实例的管理控制台,这将需要几分钟的时间来部署。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第3张图片

After our instance is deployed, it has an entire LAMP stack installed, along with WordPress. We then go to the web management panel, which is among the best — perhaps in its level of details and options it even has an edge over the competitors, like Vultr, Digital Ocean, and others.

部署完实例后,它会安装整个LAMP堆栈以及WordPress。 然后,我们进入Web管理面板,这是最好的之一-也许在细节和选项方面,它甚至比Vultr,Digital Ocean等竞争对手都具有优势。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第4张图片

There are plenty of options here, and even not-so technically apt users should have an easy time finding their way around.

这里有很多选择,即使不是这样,因此技术上合适的用户也应该很容易找到解决方法。

We can monitor the utilization of our server resources in detail here.

我们可以在此处详细监视服务器资源的利用率。

In the application dashboard, we find all the details of our WordPress installation, directions to retrieve our login details, database details, and we can connect to our instance via web-based shell (SSH).

在应用程序仪表板中,我们找到了WordPress安装的所有详细信息,检索我们的登录详细信息的指示,数据库详细信息,并且我们可以通过基于Web的外壳程序(SSH)连接到我们的实例。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第5张图片

We can also add our public keys to our account, so we can use real SSH tools to connect to our instance and have full control – we can install other server stack components, like the newest PHP version, an alternative server like NGINX, Litespeed, or Caddy, or a caching solution like Varnish. If we go with stock Apache, we may choose to login via SSH and switch our Apache server to use the more efficient event mpm, which should help us to utilize our server resources better.

我们还可以将公共密钥添加到我们的帐户中,以便我们可以使用真实的SSH工具连接到我们的实例并具有完全控制权-我们可以安装其他服务器堆栈组件,例如最新PHP版本,替代服务器,例如NGINX,Litespeed,或Caddy,或类似Varnish的缓存解决方案。 如果我们使用现货Apache,则可以选择通过SSH登录并切换我们的Apache服务器以使用效率更高的事件mpm ,这应该有助于我们更好地利用我们的服务器资源。

We can choose to install a proprietary SSL certificate, or add more virtual hosts to our server if we want to host more than one website.

如果我们要托管多个网站,我们可以选择安装专有的SSL证书,或者向我们的服务器添加更多虚拟主机。

To summarize, we have a 5-minute WordPress installation with full flexibility on the custom server instance afterwards.

总而言之,之后我们进行了5分钟的WordPress安装,并在自定义服务器实例上具有完全的灵活性。

After we have installed our instance, we have our IP address, and when we visit it inside our browser, we will be presented with the generic WordPress installation.

安装实例后,我们就有了IP地址,当我们在浏览器中访问它时,我们将看到通用的WordPress安装。

Currently, the website is available through the IP address we were assigned, because we still haven’t attached any web URL to the domain. If we purchase our domain through Alibaba (Alibaba is in the domain business, too, and they have some nice deals at the time of writing), and we use Alibaba Cloud DNS, we can assign our domain directly through our SAS web management panel.

目前,可以通过我们分配的IP地址访问该网站,因为我们仍然没有将任何Web URL附加到该域。 如果我们通过阿里巴巴购买我们的域名( 阿里巴巴也从事域名业务,并且在撰写本文时他们有一些不错的交易),并且我们使用阿里云DNS,我们可以通过SAS Web管理面板直接分配我们的域。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第6张图片

In this case, we will also be able to manage our SSL certificates from our instance’s web panel.

在这种情况下,我们还可以从实例的Web面板管理SSL证书。

If this isn’t the case, we will need to point our DNS records in our domain management panel of some other provider, to the IP address that Alibaba Cloud assigned to our SAS instance.

如果不是这种情况,我们将需要在其他提供商的域管理面板中将DNS记录指向阿里云分配给SAS实例的IP地址。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第7张图片

Image above: Namecheap’s DNS management console

上图: Namecheap的 DNS管理控制台

Now, our instance isn’t set up 100% the same as a generic, off-the-shelf Linux instance meaning that, if we want to have more websites, or change our settings, we won’t find, for example, our server setup in /etc/httpd directory as one would expect. Instead, our web management panel informs us that our relevant environment variables are in the /root/env.txt file.

现在,我们的实例与通用的现成Linux实例的设置没有100%相同,这意味着,如果我们要拥有更多的网站或更改设置,我们将找不到例如可以在/ etc / httpd目录中设置服务器。 而是,我们的Web管理面板通知我们相关的环境变量位于/root/env.txt文件中。

This is also where we will find passwords for our WordPress installation, and our MySQL database. We should login after the initial installation, and complete our WordPress user profile. At this time, provided that we previously directed our domain to our server instance, we also need to add our domain to WordPress settings under Settings > General, and add a Site Title.

这也是我们可以找到WordPress安装密码和MySQL数据库的地方。 初始安装后,我们应该登录并完成WordPress用户个人资料。 目前,只要我们先前将域定向到服务器实例,我们还需要将域添加到设置>常规下的WordPress设置中,并添加网站标题。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第8张图片

If we don’t set up the two URL settings the WordPress installation won’t work like it should, although our homepage may load without issues. After we do this, sometimes it can be necessary to save/update permalinks.

如果我们未设置这两个URL设置,则WordPress安装将无法正常运行,尽管我们的主页可能加载时没有问题。 完成此操作后,有时可能需要保存/更新永久链接。

The file /root/env.txt will tell us that our relevant Apache configuration files are in /usr/local/apache. This is where we will be able to set up our virtual hosts, and change the Apache setup.

/root/env.txt文件将告诉我们相关的Apache配置文件位于/usr/local/apache 。 在这里,我们将能够设置虚拟主机并更改Apache设置。

Alibaba SAS also allows us to set firewall rules to close access to any TCP ports. Each SAS instance can have up to 50 firewall rules. By default, only ports 22 (ssh), 443 (https) and 80 (http) are open, and others are closed. In the SAS web console, we can find the firewall under Security > Firewall. Rules open the ports, and we can add rules from the list of presets for applications that use certain ports, like telnet, FTP, SSH, MySQL and others.

阿里巴巴SAS还允许我们设置防火墙规则以关闭对任何TCP端口的访问。 每个SAS实例最多可以具有50个防火墙规则 。 默认情况下,仅打开端口22(ssh),443(https)和80(http),其他端口则关闭。 在SAS Web控制台中,我们可以在“ 安全性”> “防火墙”下找到防火墙 。 规则打开端口,我们可以从预设列表中为使用某些端口(例如telnet,FTP,SSH,MySQL和其他端口)的应用程序添加规则。

服务器部署sas_如何在阿里云SAS上部署WordPress网站_第9张图片

For backing up our instances, Alibaba Simple Application Server provides free snapshots – each server can have up to three snapshots, which can be easily restored. This is a server-level backup solution, but we recommend that important, or critical WordPress projects also have an application-level, regular backup solution such as the Updraft plugin.

为了备份我们的实例,阿里巴巴简单应用服务器提供了免费的快照-每个服务器最多可以具有三个快照,可以轻松地对其进行还原。 这是服务器级的备份解决方案,但是我们建议重要或重要的WordPress项目也应具有应用程序级的常规备份解决方案,例如Updraft插件。

These snapshots give us a way to back up the entire instance. It can take up to half hour to create a snapshot of our server, which is then available for rollback – which will overwrite the entire server.

这些快照为我们提供了一种备份整个实例的方法。 创建我们的服务器快照最多需要半小时,然后可以用于回滚–这将覆盖整个服务器。

Once we have created the snapshot of our server instance, we may also choose to upgrade it, to get more server resources. This is also a seamless process, which we can initiate by clicking the Upgrade link beside the snapshot in our instance’s management web console.

创建服务器实例的快照后,我们也可以选择对其进行升级,以获取更多服务器资源。 这也是一个无缝过程,我们可以通过单击实例管理Web控制台中快照旁边的“升级”链接来启动该过程。

Since SAS is really a higher level layer built on top of the more barebones ECS (Elastic Compute Service), we can take advantage of this, and gain more control of our server by getting to know intricacies of Elastic Compute Service (ECS).

由于SAS实际上是在更多准系统ECS(弹性计算服务)的基础上构建的更高层,因此我们可以利用这一点,并通过了解弹性计算服务(ECS)的复杂性来获得对服务器的更多控制。

结论 (Conclusion)

In this article we have given an overview of the Simple Application Server package by Alibaba Cloud – the latest major player and contender in the market of cloud services. Although some details may need polishing, we can say that the market will improve by what Alibaba has to offer – both in terms of pricing and in terms of technology.

在本文中,我们概述了阿里云(Alibaba Cloud)的Simple Application Server软件包-阿里云服务市场中的最新主要参与者和竞争者。 尽管某些细节可能需要打磨,但我们可以说,阿里巴巴所提供的产品将在价格和技术方面改善市场。

We have also gone through the deployment of a WordPress website – but we have stuck with the bare bones installation. In reality, this is an endeavor which is usually a lot more involved, depending on the actual use-case and website.

我们还完成了WordPress网站的部署-但我们坚持使用裸机安装。 实际上,根据实际用例和网站,这通常会涉及很多工作。

Advantages of Alibaba Simple Application Server are simplicity and ease of deployment. It takes less then 5 minutes to get full VPS server with WordPress website online – without advanced knowledge.

阿里巴巴简单应用服务器的优点是简单和易于部署。 在没有高级知识的情况下,只需不到5分钟即可在线获得WordPress网站的完整VPS服务器。

One of Alibaba Cloud’s best features is a unified admin interface that allows us to monitor system resources, create and restore snapshots, access the server through the shell, and more all through the web. This means that painless WP-CLI management of the whole system is, upon installation, available through the web interface – meaning easy updates, plugin installations and management, post bootstrapping, object cache flushing, and much more.

阿里云的最佳功能之一是统一的管理界面,该界面使我们能够监控系统资源,创建和还原快照,通过外壳访问服务器以及通过网络进行更多访问。 这意味着整个系统的WP-CLI轻松管理在安装时就可以通过Web界面进行,这意味着易于更新,插件安装和管理,自引导,对象缓存刷新等。

Take advantage of Alibaba Cloud’s $300 free credit for new users and take the service for a spin yourself!

充分利用阿里云为新用户提供的300美元免费信用 ,并亲自试用该服务!

翻译自: https://www.sitepoint.com/how-to-deploy-a-wordpress-site-on-alibaba-cloud-sas/

服务器部署sas

你可能感兴趣的:(数据库,大数据,python,linux,mysql)