Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Your conclusion is correct.
    I have no clue why the code below isn’t working. I’ve checked pretty much every config for NGINX that I’ve found on the server. (Plesk Onyx 17.8.11)

    location / {
    # try_files $uri $uri/ =404;
      try_files $uri $uri/ /index.php$is_args$args;
    }

    The redirect hack is a solution that Plesk offers on it’s support pages:
    After switching a WordPress website to FPM served by nginx in Plesk, it fails to load with “404 Not Found” on all pages except start page

    I’m not sure why I omitted the ‘last’ flag, but it would be better to use it.

    I got the whole thing to work using the config below

    # WebP Express rules
    # --------------------
    location ~* ^/?wp-content/.*\.(png|jpe?g)$ {
    	add_header Vary Accept;
    	expires 365d;
    	if ($http_accept !~* "webp"){
    		break;
    	}
    	try_files
    	/wp-content/webp-express/webp-images/doc-root/$uri.webp
    	$uri.webp
    	/wp-content/plugins/webp-express/wod/webp-on-demand.php?xsource=x$request_filename&wp-content=wp-content
    	;
    
    }
    
    # Route requests for non-existing webps to the converter
    location ~* ^/?wp-content/.*\.(png|jpe?g)\.webp$ {
    	#set $test "${test}A:${uri}---";
    	set $test "${test}A";
    
    	try_files
    	$uri
    	/wp-content/plugins/webp-express/wod/webp-realizer.php?wp-content=wp-content
    	;
    }
    # ------------------- (WebP Express rules ends here)
    
    if (!-e $request_filename) {
    	set $test P;
    }
    
    # If the uri points to webp-on-demand.php or a webp file, append D to the test variable
    if ($uri !~ ^/(.*)(webp-on-demand\.php|\.webp)$) {
    	set $test "${test}D";
    }
    
    if ($test = PD) {
    	rewrite ^/(.*)$ /index.php?$1;
    }

    I’ve tried both, but they don’t go together with the rewrite directive. Any attempt at creating an unexisting image on the fly fails because of the rewrite.

    I’ve tried to replace the rewrite lines with a Location block, but somehow I keep getting 404 not found errors using custom permalinks. The live webp generation works in this situation.

    I’ve also tried a combination of the above using the evil if statements. But the rewrite also messes things up there.

    I will try some more things when I’m at work.

    I believe the problem is within

    
    location / {
    # try_files $uri $uri/ =404;
    try_files $uri $uri/ /index.php$is_args$args;
    }
    

    If I’m correct, this redirects any request to the index.php.
    This also includes non-existing webp-files which therefore will not be sent to the converter.

    I’m encountering the same problem using the directive below and am still searching for a solution.

    
    # WORDPRESS PERMALINKS
    if (!-e $request_filename) {
    	rewrite ^(.+)$ /index.php?q=$1 last;
    }
    
Viewing 4 replies - 1 through 4 (of 4 total)