1. Home
  2. Knowledge Base
  3. OptimizeMember (Advanced)
  4. Using download restrictions with NGINX [OptimizeMember]

Using download restrictions with NGINX [OptimizeMember]

The OptimizeMember Download Restrictions will work with NGINX, as the access control relies almost entirely on PHP and not the web server. However, there are a few things to keep in mind if you\’re using NGINX with OptimizeMember Download Restrictions.

Preventing Access to /optimizeMember-files/

All files that you want to protect with OptimizeMember must reside in wp-content/plugins/optimizeMember-files/. OptimizeMember adds an .htaccess file to that directory to prevent public access. However, NGINX does not support .htaccess files. This means that you will need to update your NGINX server configuration to prevent public access to files in that directory.

What follows is an example of what you might add to your NGINX configuration, however we highly recommend contacting your web hosting company for assistance with making this change as each hosting environment is different.

<code>location /wordpress/wp-content/plugins/optimizeMember-files { <br>    deny  all; <br>    return 403; <br>}

Basic Download Restrictions

Basic Download Restrictions (OptimizeMember → Download Options → Basic Download Restrictions) should work just fine with NGINX.

Using the [opmFile /] Shortcode

The [opmFile /] shortcode should work just fine with NGINX. No additional configuration is necessary.

Advanced Mod-Rewrite Linkage

This feature will not work with NGINX. Rewriting in OptimizeMember depends on using an .htaccess file, which means that rewriting will not work with NGINX.

Using the [opmStream /] Shortcode and JWPlayer

If you are self-hosting your video files (i.e., in wp-content/plugins/optimizeMember-files/), then you must set the shortcode attribute rewrite="no", to tell the [opmStream /] shortcode not to do any rewriting, as rewriting will not work with NGINX.

If you are using Amazon S3/CloudFront integration and hosting your video files with Amazon, you don\’t need to do anything special–the default [opmStream /] shortcode should work as expected.

Advanced Download Restrictions

Yes, Advanced Download Restrictions (OptimizeMember → Download Options → Advanced Download Restrictions) should work just fine with NGINX, as that functionality relies on PHP and is not dependent on the web server.

Remote Auth / Podcasting

Remote Authentication, most commonly used with podcasting (OptimizeMember → Download Options → Remote Auth / Podcasting), should work fine with NGINX. The remote auth headers are sent via PHP and not the web server, so the OptimizeMember implementation of this should work with NGINX.

Summary

To summarize, the main thing you need to be aware of when using Download Restrictions with OptimizeMember and NGINX is that you must protect the /optimizeMember-files/ directory inside your NGINX web server configuration. Once that has been done, the following points should be kept in mind.

The following should work fine with NGINX:

  • Basic Download Restrictions
  • Advanced Download Restrictions
  • Remote Auth / Podcasting
  • [opmFile /] Shortcode
  • [opmStream /] Shortcode w/ self-hosted files and rewrite="no" shortcode attribute
  • [opmStream /] Shortcode w/ Amazon S3/CloudFront

The following will not work with NGINX:

  • Advanced Mod-Rewrite Linkage

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
Contact Support