[root@kvm7 ~]# vim /etc/httpd/conf/httpd.conf
[root@kvm7 ~]# grep -A5 ^DocumentRoot /etc/httpd/conf/httpd.conf
DocumentRoot "/mnt/nfsmount"
<Directory "/mnt/nfsmount">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
[root@kvm7 ~]# systemctl restart httpd.service
[root@kvm5 ~]# cal > /public/index.html
nfs_t。
[root@kvm7 ~]# ls -Z /mnt/nfsmount/ -rw-r--r--. root root system_u:object_r:nfs_t:s0 index.html
[root@kvm7 ~]# 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>
nfs_t,必須開啟 httpd_use_nfs 布林值,查看此布林值目前是 off。如果是 cifs_t 則要開啟 httpd_use_cifs 布林值。
[root@kvm7 ~]# getsebool -a | grep httpd_use_nfs httpd_use_nfs --> off
httpd_use_nfs。
[root@kvm7 ~]# setsebool -P httpd_use_nfs on [root@kvm7 ~]# getsebool -a | grep httpd_use_nfs httpd_use_nfs --> on
[root@kvm7 ~]# 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