要求1:
[root@xg ]setenforce 0(关闭selinux)
[root@xg ~]# systemctl stop firewalld(关掉防火墙)
[root@xg ~]# systemctl start httpd(启动服务器)
vim /etc/httpd/conf/vhost.conf (配置命令文件)
<VirtualHost 192.168.243.129:80>
DocumentRoot /200
ServerName www.openlab.com
<Directory /200>
AllowOverride none
Require all granted
保存退出
ehco welcome to openlab!!! > /200/index.html
要求2
<VirtualHost 192.168.243.129:80>
DocumentRoot /200
Alias /data /data
Alias /student /student
Alias /money /money
ServerName www.openlab.com
<Directory /200>
AllowOverride none
Require all granted
<Directory /data>
AllowOverride none
Require all granted
<Directory /money>
AllowOverride none
Require all granted
3.要求3
(1)<Directory /student>
AuthType Basic
AuthName “please login”
AuthUserFile /etc/httpd/users
Require song tian
#htpasswd -c /etc/httpd/users song
#htpasswd -c /etc/httpd/users tian
systemctl restart httpd
3(2)1.<Directory /money>
AllowOverride none
Require all granted
<VirtualHost 192.168.243.129:443>
ServerName www.openlab.com
DocumentRoot /200/money
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/openlab.crt
SSLCertificateKeyFile /etc/pki/tls/private/openlab.key
2.
openssl req -newkey rsa:4096 -nodes -sha256 -keyout /etc/pki/tls/private/openlab.key -x509 -days 365 -out /etc/pki/tls/certs/openlab.crt