[CentOS] Nginx and SELinux on CentOS 7

Wed Jan 1 11:00:25 UTC 2020
Nicolas Kovacs <info at microlinux.fr>

Hi,

I'm currently fiddling with Nginx on CentOS 7. Eventually I want to use it 
instead of Apache on some servers.

Apache works more or less out of the box with SELinux. My websites are all 
stored under /var/www, and ls -Z shows me that all files created under /var/www 
are correctly labeled httpd_sys_content_t.

On my sandbox server I don't have Apache (httpd) installed, only Nginx (the 
nginx package from EPEL).

I manually created the /var/www directory and put a handful of static websites 
in there to play around with. Curiously enough, I got a SELinux alert.

I took a peek in /var/www, and here's what the SELinux context looks like:

   unconfined_u:object_r:var_t:s0

Now I'm a bit puzzled. Is the correct httpd_sys_content_t context only applied 
if the httpd package is installed? How else can I explain this strange behavior?

Any suggestions?

Niki
-- 
Microlinux - Solutions informatiques durables
7, place de l'église - 30730 Montpezat
Site : https://www.microlinux.fr
Mail : info at microlinux.fr
Tél. : 04 66 63 10 32
Mob. : 06 51 80 12 12