I have installed www-servers/nginx version: 1.9.7(mainline).
Before installing the package I tried to set Expanded USE flags as it is adviced here: https://wiki.gentoo.org/wiki/Nginx
In make.conf file NGINX_ADD_HTTP="module_name" is not valid, because doesn't has any effect when building nginx package.
If I used line: NGINX_MODULES_HTTP="auth_pam security stub_status sub upload upload_progress" than it is also wrong, because then the default modules will be excluded at build time. Moreover, in that situation emerge wants to install apache2 too.
So, what is the correct syntax? How to add more modules to the existing ones? Is this a bug?
the documentation is definitely wrong, but I dunno what the right one is. technically this should be on the wiki discussion, but I'm assigning to nginx maintainers because I hope one of you knows how to do it right.
IMHO the best way is to write them in package.use like this:
www-servers/nginx NGINX_MODULES_HTTP: dav -access
This enables the "dav" module and disables the access module from the defaults.
The security module needs apache2 to get build thats why emerge wants to install it.
What Michael said; mod_security needs apache stuff. The correct way is overriding NGINX_MODULES_HTTP through your preferred portage way (env/files/etc).
Closing this as 'cantfix' since its not really related to the ebuild, but feel free to repoen if there are changes that needs to be made.