搭建web网站练习

1.搭建wordpress动态网站

[root@localhost ~]# mkdir /test  
[root@localhost ~]# cd /test   将文件上传到该目录下
[root@localhost ~]# vim /etc/httpd/conf.d/wordpress.conf    写自定义配置文件
[root@localhost test]# unzip Discuz_X3.4_SC_UTF8_0101.zip  解压安装文件
[root@localhost test]# yum install mariadb-server -y   安装数据库
[root@localhost test]# systemctl start maraidb     启动数据库

初始化(获取用户和密码)
[root@localhost test]# mysql_secure_installation

登录mysql,建立wordpress数据库
[root@localhost test]# mysql -uroot -predhat
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.3.17-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> quit
Bye
[root@localhost test]# systemctl restart mariadb

解析安装应用的PHP界面
[root@localhost test]# yum install php* -y

重启http服务以及数据库服务
[root@localhost test]# systemctl restart mariadb
[root@localhost test]# systemctl restart httpd

由于其他用户的权限不够,无法完成安装,所以为其他用户赋予写权限
[root@localhost ~]# cd /test/dir_SC_UTF8/upload
[root@localhost upload]# chmod o+w config data uc_* -R

自定义配置文件
在这里插入图片描述
论坛搭建完成
在这里插入图片描述

2.综合练习:请给openlab搭建web网站

网站需求:
1.基于域名www.openlab.com可以访问网站内容为 welcome to openlab!!!
2.给该公司创建三个虚拟网站目录分别显示学生信息,教学资料和缴费网站,基于www.openlab.com/student 网站访问学生信息,www.openlab.com/data网站访问教学资料
www.openlab.com/money网站访问缴费网站。
3.要求
(1)学生信息网站只有song和tian两人可以访问,其他用户不能访问。
(2)访问缴费网站实现数据加密基于https访问。

提前准备:挂载,配置yum源,安装apache http server 软件包

[root@localhost ~]# systemctl stop firewalld  关闭防火墙
[root@localhost ~]# setenforce 0  关闭selinux防火墙
[root@localhost ~]# vim /etc/httpd/conf.d/openlab.conf  自定义一个配置文件名为openlab.conf

在这里插入图片描述
hosts目录中写入
在这里插入图片描述

[root@localhost ~]# mkdir /openlab   
[root@localhost ~]# mkdir /1 /2 /3
[root@localhost ~]# echo Welcome to openlab !!! > /openlab/index.html    设置访问该目录下的资源的站点内容
[root@localhost ~]# echo 欢迎访问学生信息 > /1/index.html
[root@localhost ~]# echo 欢迎访问教学资料 > /2/index.html
[root@localhost ~]# echo 欢迎访问缴费页面 > /3/index.html
增加用户song  tian
[root@localhost ~]# htpasswd -c /etc/httpd/users song
[root@localhost ~]# htpasswd /etc/httpd/users tian
安装SSL加密包
[root@localhost ~]# dnf install mod-ssl -y
cd到该目录下
[root@localhost conf.d]# cd /etc/pki/tls/certs
制作安全证书
[root@localhost certs]# openssl req -utf8 -newkey rsa:4096 -nodes -sha256 -keyout openlab.key -x509 -days 356 -out openlab.crt
将制作好的位于目录/etc/pki/tls/certs的openlab.key文件移动到/etc/pki/tls/private中
[root@localhost certs]# mv openlab.key ../private/
重启服务器
[root@localhost ~]# systemctl restart httpd

制作安全证书
在这里插入图片描述
结果:
主页面:
在这里插入图片描述
学生页面
在这里插入图片描述
在这里插入图片描述
资料页面
在这里插入图片描述
缴费页面
在这里插入图片描述
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值