【无标题】

第一步:挂载,安装,关闭防火墙和selinux

[root@localhost hh]# mount /dev/sr0 /mnt

[root@localhost hh]# yum install httpd
[root@localhost hh]# systemctl stop firewalld
[root@localhost hh]# setenforce 0

第二步:更改配置,实现自定义设置

[root@localhost hh]# cd /etc/httpd/conf.d
[root@localhost conf.d]# vim hhh.conf

<VirtualHost 192.168.233.131:80>
        Servername www.openlab.com
        DocumentRoot /www/openlab
</VirtualHost>

<Directory /www/>
        AllowOverride none
        Require all granted
</Directory>
手动建立连接

[root@localhost conf.d]# cd /etc
[root@localhost etc]# vim hosts
192.168.233.131 www.openlab.com

创建目录
[root@localhost etc]# mkdir /www/openlab 
[root@localhost etc]# echo welcome to openlab > /www/openlab/index.html

测试:
[root@localhost etc]# curl http://www.openlab.com
welcome to openlab

第一步:创建目录

[root@localhost etc]# cd /root
[root@localhost ~]# mkdir {student,data,money}

修改权限:[root@localhost ~]# chmod /root 777

第二步:添加内容

[root@localhost ~]# echo who is money > /root/money/index.html
[root@localhost ~]# echo who is data > /root/data/index.html
[root@localhost ~]# echo who is student > /root/student/index.html

第一步:创建用户

[root@localhost ~]# htpasswd -c /etc/httpd/users song
New password: 
Re-type new password: 
htpasswd: password verification error
[root@localhost ~]# htpasswd /etc/httpd/users tian
New password: 
Re-type new password: 
Adding password for user tian
 

第二步:用户访问控制

<Directory /www/openlab/student>
        AllowOverride none
        AuthType Basic
        AuthName "Please Login..."
        AuthUserfile /etc/httpd/users
        Require user song tian
</Directory>

测试:

SSL:

装包:[root@localhost ~]# yum install mod_ssl

生成证书:

[root@localhost ~]# openssl req -newkey rsa -nods -keyout openlab.key -x509 -days 365 -out openlab.crt

Country Name (2 letter code) [XX]:86
State or Province Name (full name) []:jiangsu
Locality Name (eg, city) [Default City]:nanjing
Organization Name (eg, company) [Default Company Ltd]:openlab
Organizational Unit Name (eg, section) []:ce
Common Name (eg, your name or your server's hostname) []:localhost
Email Address []:admin

添加信息:(所有)

<VirtualHost 192.168.233.131:80>
        Servername www.openlab.com
        DocumentRoot /www/openlab
        Alias /student /root/student
        Alias /data /root/data
</VirtualHost>

<Directory /www/>
        AllowOverride none
        Require all granted
</Directory>

<Directory /root/data>
        AllowOverride none
        Require all granted
</Directory>

<Directory /root/money>
        AllowOverride none
        Require all granted
</Directory>


<Directory /root/student>
        AllowOverride none
        AuthType Basic
        AuthName "Please Login..."
        AuthUserfile /etc/httpd/users
        Require user song tian
</Directory>

<VirtualHost 192.168.233.131:443>
        ServerName www.openlab.com
        DocumentRoot /www/openlab
        Alias /money /root/money
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/localhost.crt
        SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
</VirtualHost>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

老小孩-

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值