[root@kvm7 ~]# yum install httpd -y
[root@kvm7 ~]# systemctl enable httpd.service [root@kvm7 ~]# systemctl start httpd
httpd_t,運作在 httpd_t domain。
[root@kvm5 ~]# ps -eZ | grep httpd system_u:system_r:httpd_t:s0 10803 ? 00:00:00 httpd system_u:system_r:httpd_t:s0 10804 ? 00:00:00 httpd system_u:system_r:httpd_t:s0 10805 ? 00:00:00 httpd system_u:system_r:httpd_t:s0 10806 ? 00:00:00 httpd system_u:system_r:httpd_t:s0 10807 ? 00:00:00 httpd system_u:system_r:httpd_t:s0 10808 ? 00:00:00 httpd
[root@kvm7 ~]# cd /var/www/html/
[root@kvm7 html]# cal > ~/index.html [root@kvm7 html]# cal > index1.html
[root@kvm7 html]# mv ~/index.html .
admin_home_t。
[root@kvm7 html]# ls -Z index*.html -rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 index1.html -rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 index.html
httpd_sys_content_t,所以網頁訪問成功,列出月曆。
[root@kvm7 html]# curl http://127.0.0.1/index1.html
October 2019
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
admin_home_t,所以出現没有權限存取的訊息,網頁無法訪問。
[root@kvm7 html]# curl http://127.0.0.1/index.html <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /index.html on this server.</p> </body></html>
httpd_sys_content_t。
[root@kvm7 html]# restorecon index.html [root@kvm7 html]# ls -Z index*.html -rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 index1.html -rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 index.html
[root@kvm7 html]# curl http://127.0.0.1/index.html
October 2019
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31