Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter wpgeert

    (@wpgeert)

    I have tried with the following code:

    if ($uri ~ "/wp-content/uploads"){
            set $rule_0 1;
    }
    if ($uri ~ "/wp-content/themes"){
            set $rule_0 1;
    }
    if ($rule_0 = "1"){
            rewrite /.(?:jpg|jpeg|gif|png)$ /wp-content/plugins/adaptive-images/adaptive-images-script.php last;
    }

    But this isn’t working…

    Plugin Author Takis Bouyouris

    (@nevma)

    Hello there,

    Well, I must admit in advance that we are not actively testing the plugin on Nginx, so we do not officially support it. However, we are pretty confident that the plugin can work along with Nginx just as well as Apache, as long as the correct configuration is made.

    Now, the issue has been discussed before in the support forum here: https://www.ads-software.com/support/topic/rules-for-nginx?replies=15 and it seems that the proper configuration should be something like:

    location assets {
    }
    
    # THIS IS THE CACHE DIR INSIDE /wp-content
    
    location cache/adaptive-images {
    }
    
    # THIS IS TH THE PHP SCRIPT INSIDE THE PLUGIN DIRECTORY
    
    location / {
        rewrite \.(?:jpe?g|gif|png)$ /adaptive-images-script.php;
    }

    I am sorry I cannot provide a definitively correct configuration for Nginx, but the code above is the general idea. You see in Apache the plugin is able to make direct changes to the .htaccess file. Perhaps the previous thread can provide some more information on how to handle this.

    Please, do let us know how this works out for you, because Nginx is indeed one of our future priorities.

    Cheers,
    Takis

    Thread Starter wpgeert

    (@wpgeert)

    Hi Takis,

    Thanks for your response! The other discussion yo mention is an other use case, as you can use Nginx in 2 ways:
    – As Reverse Proxy with Apache (Other discussion)
    – As a replacement for Apache (My case)

    It’s rather strange to not support Nginx nowadays as it’s the best way to get a fast WordPress website.

    The suggested code doesn’t seem to work.

    Plugin Author Takis Bouyouris

    (@nevma)

    Well, yes, if NginX is weas used as a reverse proxy, something like a caching server, then this would be a totally different case. Then the configuration lines like this one:

    location / {
        rewrite \.(?:jpe?g|gif|png)$ /adaptive-images-script.php;
    }

    would be totally meaningless!

    But I think that the other thread does refer to the case where NginX actually replaces Apache and runs the PHP code. I am not sure how exactly this configuration is finetuned to work correctly, though!

    You are right about NginX, all in all, and we will definitely work on this direction.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Nginx’ is closed to new replies.