File Filtering with Nginx

PublishPress Permissions Pro has support for generation of Nginx rewrite rules. Control of direct file URL access requires rewrite rules at the server configuration level, but previously only Apache servers were supported. Note that whereas PublishPress Permissions provides Apache solutions with nearly zero configuration, Nginx solutions are not complete out-of-the-box. Due to differences in the behavior of Nginx, server administrators will also need to implement their own script to trigger an Nginx configuration reload.

To output Nginx rewrite rules, define the following constants in wp-config.php:

define( 'PP_NGINX_CFG_PATH', '/path/to/your/supplemental/file.conf' );

// typical configuration (modify with actual path to folder your uploads folder is in, relative to http root) 
define( 'PP_FILE_ROOT', '/wp-content' );  

NOTE that you will need to provide your own server scripts to trigger an Nginx reload upon config file update.

On network installations, rules from all sites are inserted into the same file, specified by PP_NGINX_CFG_PATH. Each site's rules are preceded by a distinguishing comment tag.

To disable .htaccess output, define the following constant (in addition to PP_NGINX_CFG_PATH) :

define( 'PP_NO_HTACCESS', true );

You may manually force regeneration of Nginx or .htaccess rules by creating the file defined in this constant:

define( 'PP_FILE_REGEN_TRIGGER', '/path/to/your/trigger/file' );