搭建一个基于https://www.zuoye.com:22222访问的web网站,网站首页在/www/https/,内容为zuoye,可以根据https://www.zuoye.com:22222/mimi访问到的信息为mimi,该网站的实际内容在/usr/local/secret,该网站的内容只有用户xiaoming能够查看。
步骤:
1.首先挂载光盘,写yum源
[root@localhost ~]# mount /dev/sr0 /mnt
mount: /mnt: /dev/sr0 already mounted on /run/media/root/RHEL-8-0-0-BaseOS-x86_64
[root@localhost ~]# cat /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
2、安装httpd 、mod_ssl包
yum install httpd -y
yum install mod_ssl -y
3、切换到/etc/pki/tls/certs/目录下
[root@localhost ~]# cd /etc/pki/tls/certs/
利用rz安装Makefile
先安装rz包
[root@localhost certs]# yum install lrzsz -y
使用make命令给自己颁发证书
若无make 先安装make包
[root@localhost certs]# rpm -q make
[root@localhost certs]# make zhengshu.crt
e is 65537 (0x010001)
Enter pass phrase:
Verifying - Enter pass phrase:
umask 77 ;
/usr/bin/openssl req -utf8 -new -key zhengshu.key -x509 -days 365 -out zhengshu.crt -set_serial 0
Enter pass phrase for zhengshu.key:
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:sx
Locality Name (eg, city) [Default City]:xian
Organization Name (eg, company) [Default Company Ltd]:open
Organizational Unit Name (eg, section) []:ce
Common Name (eg, your name or your server’s hostname) []:www.zuoye.com
Email Address []:admin@open.com
4、编辑配置文件
cd /etc/httpd/conf.d/
vim host-zhengshu.conf
5、在Linux的/etc/hosts 下写域名解析
在windows的C:\Windows\System32\drivers\etc\hosts下写域名解析
6、创建目录 ,写网页内容
[root@localhost conf.d]# mkdir /www/https
[root@localhost conf.d]# echo zuoye > /www/https/index.html
7、新建用户
8、创建目录,写网页内容
9、关闭防火墙,selinux,重启httpd服务
systemctl stop firewalld
systemctl restart httpd