httpd的实例(经典)
实例一
- 1.从http://ldap.example.com/pub/example.html下载文件,并重命名为index.html,不修改文件内容
- 2.将文件index.html拷贝到你的DocumentRoot目录
- 3 来自于example.com的客户端可以访问web服务器
- 4.来自于my133t.org的客户端的访问会被拒绝
[root@server30 ~]# cd /var/www/
cgi-bin/ html/
[root@server30 ~]# cd /var/www/html/
[root@server30 html]# wget -O index.html http://ldap.example.com/pub/example.html
--2019-01-17 19:03:11-- http://ldap.example.com/pub/example.html
Resolving ldap.example.com (ldap.example.com)... 172.16.30.254
Connecting to ldap.example.com (ldap.example.com)|172.16.30.254|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21 [text/html]
Saving to: ‘index.html’
100%[======================================>] 21 --.-K/s in 0s
2019-01-17 19:03:11 (3.25 MB/s) - ‘index.html’ saved [21/21]
[root@server30 html]# ls
index.html
[root@server30 html]# cat index.html
server30.example.com
[root@server30 html]#
[root@server30 html]# firewall-cmd --add-rich-rule 'rule family=ipv4 source address=172.16.30.0/24 service name=http accept' --permanent
success
[root@server30 html]# firewall-cmd --reload
success
[root@server30 html]#
[root@server30 ~]# systemctl restart httpd
[root@server30 ~]# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[root@server30 ~]#
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/44b547babacef8d5d312683e3f75c9f7.png)
实例二
- 已签名证书从http://ldap.example.com/pub/server30.crt获取
- 证书的密钥从http://ldap.example.com/pub/server30.key获取
- 证书的签名授权信息从http://ldap.example.com/pub/group30.crt获取
[root@server30 ~]# rpm -qa | grep mod_ssl
mod_ssl-2.4.6-17.el7.x86_64
[root@server30 ~]#
[root@server30 ~]# cd /etc/httpd/conf.d/
[root@server30 conf.d]# ls
autoindex.conf README ssl.conf