nginx 설치 직후 기동 할 때 /var/run/nginx.pid 퍼미션 read/write denied 오류가 날 때
type=SERVICE_START msg=audit(1686632819.779:13287): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nginx comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'UID="root" AUID="unset"
[root@vmr97102715AA ~]# cat /var/log/audit/audit.log | grep nginx | grep denied
type=AVC msg=audit(1686632606.360:13283): avc: denied { read write } for pid=2361443 comm="nginx" name="nginx.pid" dev="tmpfs" ino=14602875 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file permissive=0
type=AVC msg=audit(1686632819.775:13286): avc: denied { read write } for pid=2361566 comm="nginx" name="nginx.pid" dev="tmpfs" ino=14642126 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file permissive=0
restorecon -R -v /var/run/nginx*
수행하면 됩니다
원인은 /var/run/nginx.pid 는 root 권한인데 nginx가 기동될 때 pid를 기록할 수가 없어서 입니다