华为云搭建Discuz论坛网站详细教程 |
您所在的位置:网站首页 › 搭建个人论坛合法 › 华为云搭建Discuz论坛网站详细教程 |
华为云可以为您提供丰富的解决方案,现以搭建网站业务为例介绍华为云的应用场景。 小型网站一般会部署在单台服务器上,用户对页面的访问,动静态内容的使用,数据库的使用和计算全部是在一台服务器上完成的。当网站业务发展到中型规模时,数据库的访问量剧增,单台服务器配置已不能满足业务要求,此时,可将数据库和网站程序分开部署在不同的服务器上分担性能压力。 以使用华为云搭建某论坛网站为例,在这种场景下有以下需求: 将数据节点与业务节点分开部署在不同的服务器上。可针对不同业务量动态调整服务器个数。可自动将流量分发到多台服务器。网站备案。根据国家规定,如果客户网站所使用的服务器是在中国大陆,就需要进行ICP备案,没有备案的域名不能访问网站。如果使用国际版则不需要。 设计方案 针对应用场景的各项需求,使用华为云建站方案及所需服务 搭建网站:购买两台弹性云服务器代替传统服务器,分别作为网站的数据节点和基础业务节点。由虚拟私有云为弹性云服务器提供网络资源。购买服务器过程中,用户可以根据实际部署方案的要求,选择是否为云服务器挂载云硬盘作为数据盘。购买弹性云服务器,虚拟私有云,云硬盘(可选)。 目的:将数据节点与业务节点分开部署。 配置特性:根据业务需求和策略采用弹性伸缩,使用基础业务节点的镜像动态地调整作为业务节点的弹性云服务器实例个数,保证业务平稳健康运行。购买弹性伸缩。 目的:针对不同业务量动态调整服务器个数。 配置特性:使用负载均衡将访问流量自动分发到多台业务节点弹性云服务器,扩展应用系统对外的服务能力,实现更高水平的应用程序容错性能。购买弹性负载均衡。 目的:自动将流量分发到多台服务器。 架构图 配置例子 搭建流程 准备软件-搭建数据库-搭建web环境-部署网站代码-验证搭建结果 准备软件 WinSCP-WinSCP是在Windows环境下使用SSH的开源图形化SFTP客户端,用于在本地与远程计算机间安全的复制文件。下载地址:WinSCP Discuz X3.3软件包-请在Discuz官方网站下载Discuz X3.3(简体UTF8)软件包 ,用于部署网站程序。Discuz相关软件包和资料请官方网站在获取。 搭建数据库 安装MySQL 本文档以CentOS 7.2操作系统为例安装MySQL。 远程登录云服务器discuz01,填写用户名和密码。依次执行以下命令,安装MySQL。wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm yum -y install mysql57-community-release-el7-10.noarch.rpm yum -y install mysql-community-server --nogpgcheck 配置MySQL 执行以下命令,启动MySQL服务。systemctl start mysqld systemctl enable mysqld 2.查看MySQL运行状态。 systemctl status mysqld.service 回显信息如下所示: # systemctl status mysqld.service ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-08-23 10:54:55 CST; 7s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Main PID: 7873 (mysqld) CGroup: /system.slice/mysqld.service └─7873 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid Aug 23 10:54:49 ecs-adc3-420652-aed6 systemd[1]: Starting MySQL Server... Aug 23 10:54:55 ecs-adc3-420652-aed6 systemd[1]: Started MySQL Server. 3.执行以下命令,获取安装MySQL时自动设置的root用户密码。 grep 'temporary password' /var/log/mysqld.log 回显如下类似信息。 2021-08-16T11:33:37.790533Z 1 [Note] A temporary password is generated for root@localhost: ;8nPd29lhs,k 4.执行以下命令,并按照回显提示信息进行操作,加固MySQL。 mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: #输入上一步骤中获取的安装MySQL时自动设置的root用户密码 The existing password for the user account root has expired. Please set a new password. New password: #设置新的root用户密码 Re-enter new password: #再次输入密码 The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : N #是否更改root用户密码,输入N ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y #是否删除匿名用户,输入Y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y #禁止root远程登录,输入Y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y #是否删除test库和对它的访问权限,输入Y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y #是否重新加载授权表,输入Y Success. All done! 5.执行以下命令,再根据提示输入数据库管理员root账号的密码进入数据库。 mysql -u root -p 6.执行以下命令,使用MySQL数据库。 use mysql; 7.执行以下命令,查看用户列表。 select host,user from user; 说明: 此命令及以下数据库语句均以分号结尾,请勿忽略。 8.执行以下命令,刷新用户列表并允许所有IP对数据库进行访问。 update user set host='%' where user='root' LIMIT 1; 9.执行以下命令,强制刷新权限。允许同一子网中设置为允许访问的云服务器通过私有IP对MySQL数据库进行访问。 flush privileges; 10.执行以下命令,退出数据库。 quit 11.执行以下命令,重启MySQL服务。 systemctl restart mysqld 12.执行以下命令,设置开机自动启动MySQL服务。 systemctl enable mysqld 13.执行以下命令,关闭防火墙。 systemctl stop firewalld.service 14.重新查看防火墙状态是否为关闭。 systemctl status firewalld 搭建Web环境 安装Web环境 将弹性公网IP从云服务器discuz01上解绑,并绑定至云服务器discuz02上。
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm yum -y install mysql57-community-release-el7-10.noarch.rpm yum -y install mysql-community-server --nogpgcheck 3.执行以下命令,安装Apache服务器、PHPFastCGI管理器、MySQL客户端和MySQL数据库服务器。 yum install -y httpd php php-fpm mysql mysql-server php-mysql 回显如下,说明安装成功。 Complete! 4.执行以下命令,更新安装Apache服务器、PHPFastCGI管理器、MySQL客户端和MySQL数据库服务器。 yum reinstall -y httpd php php-fpm mysql mysql-server php-mysql 回显如下,更新安装成功。 Complete! 配置Web环境 1.执行以下命令,启动httpd服务。 service httpd start 2.执行以下命令,设置开机自动启动httpd服务。 chkconfig httpd on 3.执行以下命令,启动php-fpm服务。 service php-fpm start 4.执行以下命令,设置开机自动启动php-fpm服务。 chkconfig php-fpm on 5.执行以下命令,关闭防火墙。 systemctl stop firewalld.service 6.执行以下命令,重新查看防火墙状态是否为关闭。 systemctl status firewalld 7.执行以下命令,启动MySQL服务。 systemctl start mysqld 8.执行以下命令,设置开机自动启动MySQL服务。 systemctl enable mysqld.service 9.在浏览器中输入http://弹性公网IP地址 ,即可访问服务器的默认主页。 部署网站代码 验证搭建结果 在浏览器中输入:http://弹性公网IP地址/forum.php 可登录论坛主页则说明网站搭建成功。 欲知更多详情或购买流程请联系 Telegram:Moon_cloud9 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |