请给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访问。
[C:\~]$ ssh 192.168.227.129
Connecting to 192.168.227.129:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Activate the web console with: systemctl enable --now cockpit.socket
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Tue May 23 14:10:37 2023 from 192.168.227.1
[root@server ~]#
[root@server ~]# yum install httpd -y
CentOS-9-stream - Base - mirrors.aliyun.com 259 B/s | 3.9 kB 00:15
CentOS-9-stream - Base - mirrors.aliyun.com
mod_http2-1.15.19-4.el9.x86_64 mod_lua-2.4.57-2.el9.x86_64
完毕!
[root@server ~]# setenforce 0
setenforce: SELinux is disabled
[root@server ~]# systemctl stop firewalld
[root@server ~]# systemctl disable firewalld
[root@server ~]# systemctl start httpd
[root@server ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@server ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2023-05-29 13:02:19 CST; 13s ago
Docs: man:httpd.service(8)
Main PID: 32976 (httpd)
Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec: 0 B/sec"
Tasks: 213 (limit: 11984)
Memory: 43.3M
CPU: 63ms
CGroup: /system.slice/httpd.service
├─32976 /usr/sbin/httpd -DFOREGROUND
├─32978 /usr/sbin/httpd -DFOREGROUND
├─32979 /usr/sbin/httpd -DFOREGROUND
├─32980 /usr/sbin/httpd -DFOREGROUND
└─32981 /usr/sbin/httpd -DFOREGROUND
5月 29 13:02:12 server systemd[1]: Starting The Apache HTTP Server...
5月 29 13:02:12 server httpd[32976]: AH00558: httpd: Could not reliably determine the server's fully qualified domain>
5月 29 13:02:19 server systemd[1]: Started The Apache HTTP Server.
5月 29 13:02:19 server httpd[32976]: Server configured, listening on: port 80
[root@server ~]# echo "Welcome to openlab.com" > /var/www/html/index.html
[root@server ~]# systemctl start httpd
[root@server ~]# vim /etc/hosts
[root@server ~]# systemctl restart httpd
[root@server ~]# echo "Welcome to openlab.com" > /var/www/html/index.html
[root@server ~]# systemctl restart httpd
[root@server ~]# systemctl restart httpd
[root@server ~]# mkdir -p /www/openlab
[root@server ~]# systemctl restart httpd
[root@server ~]# mkdir -p /www/openlab
[root@server ~]# systemctl restart httpd
[root@server ~]# vim /etc/hosts
[root@server ~]# vim /etc/httpd/conf.d/userdir.conf
[root@server ~]# vim /etc/httpd/conf.d/userdir.conf
[root@server ~]# mkdir -p /www/openlab/student
[root@server ~]# mkdir -p /www/openlab/data
[root@server ~]# mkdir -p /www/openlab/money
[root@server ~]# vim /etc/hosts
[root@server ~]# vim /etc/hosts
[root@server ~]# vim /etc/httpd/conf/httpd.conf
[root@server ~]# systemctl restart httpd
[root@server ~]# systemctl restart httpd
[root@server ~]# vim /etc/hosts
[root@server ~]# vim /etc/httpd/conf/httpd.conf
[root@server ~]# vim /etc/httpd/conf/httpd.conf
[root@server ~]# echo 'this is openlab data' > /www/openlab/data/index.html
[root@server ~]# echo 'this is openlab student' > /www/openlab/student/index.html
[root@server ~]# systemctl restart httpd
[root@server ~]# systemctl restart httpd
[root@server ~]# echo 'this is openlab money' > /www/openlab/money/index.html
[root@server ~]# vim /etc/httpd/conf/httpd.conf
[root@server ~]# systemctl restart httpd
[root@server ~]#
[root@server ~]# echo 'welcome to openlab!!!' > /www/openlab/index.html
[root@server ~]# systemctl restart httpd
[root@server ~]# mount /dev/sr0 /mnt
mount: /mnt: /dev/sr0 已挂载于 /run/media/root/RHEL-9-1-0-BaseOS-x86_64.
[root@server ~]# yum install mod_ssl -y
上次元数据过期检查:0:34:23 前,执行于 2023年05月29日 星期一 17时10分25秒。
依赖关系解决。
======================================================================================================================
软件包 架构 版本 仓库 大小
======================================================================================================================
安装:
mod_ssl x86_64 1:2.4.57-2.el9 AppStream 112 k
升级:
sscg x86_64 3.0.0-7.el9 AppStream
[root@server ~]# yum install httpd mod_ssl -y
上次元数据过期检查:0:20:59 前,执行于 2023年05月29日 星期一 20时01分27秒。
软件包 httpd-2.4.57-2.el9.x86_64 已安装。
软件包 mod_ssl-1:2.4.57-2.el9.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
[root@server ~]# cd /etc/pki/tls/private/
[root@server private]# ls
localhost.key openlab.key
[root@server private]# openssl genrsa -aes128 2048 > zy.key
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
[root@server private]# mkdir /openlab
[root@server private]# cd
[root@server ~]# mkdir /openlab
mkdir: 无法创建目录 “/openlab”: 文件已存在
[root@server ~]# cd /etc/pki/tls/private/
[root@server private]# openssl genrsa -aes128 2048 > openlab.key
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
[root@server private]# cd
[root@server ~]# mkdir /openlab
mkdir: 无法创建目录 “/openlab”: 文件已存在
[root@server ~]# cd /etc/pki/tls/private/
[root@server private]# ls
localhost.key openlab.key zy.key
[root@server private]# openssl genrsa -aes128 2048 > openlab.key
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
[root@server private]# cd /etc/pki/tls/certs/
[root@server certs]# openssl req -utf8 -new -key /etc/pki/tls/private/openlab.key -x509 -days 365 -out openlab.crt
Enter pass phrase for /etc/pki/tls/private/openlab.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:86
State or Province Name (full name) []:shanxi
Locality Name (eg, city) [Default City]:xi'an
Organization Name (eg, company) [Default Company Ltd]:openlab
Organizational Unit Name (eg, section) []:ce
Common Name (eg, your name or your server's hostname) []:server
Email Address []:andy@qq.com
[root@server certs]# cd
[root@server ~]# vim /etc/httpd/conf.d/ssl.conf
[root@server ~]# systemctl start httpd
[root@server ~]# mkdir /openlab
mkdir: 无法创建目录 “/openlab”: 文件已存在
[root@server ~]# cd /etc/pki/tls/private/
[root@server private]# openssl genrsa -aes128 2048 > openlab.key
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
[root@server private]# cd
[root@server ~]# mkdir /openlab
mkdir: 无法创建目录 “/openlab”: 文件已存在
[root@server ~]# cd /etc/pki/tls/private/
[root@server private]# ls
localhost.key openlab.key zy.key
[root@server private]# openssl genrsa -aes128 2048 > openlab.key
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
[root@server private]# cd /etc/pki/tls/certs/
[root@server certs]# openssl req -utf8 -new -key /etc/pki/tls/private/openlab.key -x509 -days 365 -out openlab.crt
Enter pass phrase for /etc/pki/tls/private/openlab.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:86
State or Province Name (full name) []:shanxi
Locality Name (eg, city) [Default City]:xi'an
Organization Name (eg, company) [Default Company Ltd]:openlab
Organizational Unit Name (eg, section) []:ce
Common Name (eg, your name or your server's hostname) []:server
Email Address []:andy@qq.com
[root@server certs]# cd
[root@server ~]# vim /etc/httpd/conf.d/ssl.conf
[root@server ~]# systemctl start httpd
参考链接:
综合练习:请给openlab搭建web网站_潜行的鱼的博客-CSDN博客
总之:第三题云里雾里。哈哈哈,还不太对。不能实现其他用户不能登陆。