[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 Apr 23 14:10:37 2024 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 2024-04-10 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
4月10 13:02:12 server systemd[1]: Starting The Apache HTTP Server...
4月 10 13:02:12 server httpd[32976]: AH00558: httpd: Could not reliably determine the server's fully qualified domain>
4月 10 13:02:19 server systemd[1]: Started The Apache HTTP Server.
4月 10 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
======================================================================================================================
软件包 架构 版本 仓库 大小
======================================================================================================================
安装:
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
软件包 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