任意のディレクトリに fcontext semanage の新しいルールを追加または変更して適用すると、次のようになります。
# How to add this rule for apply changes whit restoreconf -Rv
/var/www/html(/.*)?/media(/.*)? system_u:object_r:httpd_sys_rw_content_t:s0
# Here found all files have .bin and conf
/etc/selinux/targeted/contexts/files
適用するかどうかの結果は、SELinux で問題なく書き込みと読み取りを行うために平均的な httpd フォルダーを使用することです。
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/domain.com/media
#restorecon -Rv not apply changes
答え1
質問が少し不完全なようですが、私が理解したところによると、仮想ホスト/ドメインのhttpd_sys_rw_content_t
すべてのmedia
サブフォルダーとその中のすべてにコンテキストを適用したいということですね。次のコマンドでそれができるはずです。
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/(.*)/media(/.*)?"
restorecon -Rv /var/www/html
これにより、ドメイン フォルダー内のすべてのメディア サブフォルダーにコンテキスト タイプが適用されます。