再版: nginx の SELinux 保護を一時的および永続的にオフにする方法

転載元:https://www.jianshu.com/p/491817981a32

SELinuxを一時的にシャットダウンする

setenforce 0    # 关闭 Selinux  
setenforce 1    # 开启 Selinux

一時的なシャットダウン後、現時点では nginx にアクセスできます

SELinuxを永久にシャットダウンする

永続的なシャットダウンを有効にするには再起動が必要です
vim /etc/selinux/config を編集します[root@localhost]# vim /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

nginxホワイトリストを許可する

yum install policycoreutils-python  
cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx  
semodule -i mynginx.pp

著者:liurongming
リンク:https
://www.jianshu.com/p/491817981a32出典:Jianshu
著作権は著者に属します。商業的転載の場合は著者に連絡して承認を求め、非商業的転載の場合は出典を明記してください。

おすすめ

転載: blog.csdn.net/liuqun69/article/details/127317216