Nginx cannot access restricted content

Users with correct S2member levels cannot access pages which they ought to be able to see, but are redirected back to the membership options (join) page.

s2-server-scanner.php shows no problems with server configuration.

Typical redirect looks like this:
https://mydomain.tld/members/join/?_s2member_vars=page..level..6..page..3158..L29mc3RlZC1kb2N1bWVudGF0aW9uLw%3D%3D&_s2member_sig=1521581553-b3fe012aac0b738494259f4e99a37cf0

The server is running Nginx from a Plesk control panel on a VPS. PHP 5.6.30 (I have tried 7.0.17 and 5.4.45) is running as an FPM application served by NGINX. I have tried FastCGI / Apache but the site does not respond at all with this setting.

Any ideas how to address this?

Using S2Member Version 170722 + s2Member Pro v170722

Test in a clean environment: I.e. with no other plugins or caching, and a default .htaccess file and theme.

Thanks Tim - no joy yet -
I have:

  1. Deactivated ALL plugiins
  2. Set a basic Wordpress theme Twenty Seventeen
  3. Deactivated and reactivated S2Member
  4. removed .htaccess (not needed in NGINX)
  5. removed all directives from NGINX config apart from
    rewrite /$ /index.php break;
    (without this it does not work)

Any other ideas?

Is there some server level caching in place?

No caching in use anywhere.

OK I tried a fresh install on a new domain under NGINX and all was fine
SO…
Back on the problem site (currently all plugins apart from S2member disabled) I created a new page and set restriction options.
This new page works fine! ( users with high enough access level see it others do not)
Back at an existing page with the same membership level restriction the same user CANNOT access it!!

It seems as though there is something set on existing pages which is preventing their being accessed at all, whereas new pages with apparently the same settings are OK.

I assumed the logic for S2 was to look at one flag on some table and check for access rights - perhaps there are multiple flags or somewhere else I should look to try to figure out where the logic is failing…?

All settings are in one “blob” in the wp_options table of the database.

It sounds as though you have some additional protection set (such as a ccap, though the URL you gave before didn’t show that) or else the installation of s2Member on this site is corrupted. (If that’s true. You will need to turn off Deletion Safeguards and then delete and reinstall.)

ccap = captcha?
Not got anything I can think of like that going on.

I have now reactivated all the plugins originally running on the site and - everything seems to be behaving for newly created pages. BUT NOT for pages that were already on the system. If I set the existing pages to have no restriction, save, and then set any level of restriction back on they just become inaccessible again! Would deleting the data in the ‘blob’ field of the table potentially sort this out? What is it called as I could try doing this by hand.

ccap = custom capability, not captcha.

Your thoughts about editing or deleting the ‘blob’? (If I knew what it was called)

I would guess that deleting it would ‘wipe the slate clean’ and might mean that I could then set new restrictions on old pages that would actually work?

Deleting the blob would mean that s2Member wouldn’t work. If you go make a look at it, you’ll see why.

Manual editing of it won’t work either. You need to identify the issue from within WP rather than by looking at the database.

An uninstall followed by a reinstall then?

Thing is many uninstalls leave data behind - would I not need to delete the blob anyway?

If so what is the field name of the blob?

The blob’s field name is ws_plugin__s2member_options.

But you need to delete it using the proper method; otherwise all sorts of problems can occur. That method involves first going to General Options and setting Plugin Deletion Safeguards to No. Then save. Then uninstall s2Member just as you would any other plugin. This method will remove all traces of s2Member safely.

Then you can try reinstalling.

There is even an official help here:

I’ld guess maybe something in nginx.conf is wrongly set? You will need to write info for each domain into the nginx.conf file, so look if both domains are setup correctly (and then check if s2member directory is proper protected).