HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/delta/wp-content/plugins/wp-smushit/core/webp/class-webp-nginx.php
<?php
namespace Smush\Core\Webp;

class Webp_Nginx {
	/**
	 * Code to use on Nginx servers.
	 *
	 * @param bool $marker whether to wrap code with marker comment lines.
	 * @return string
	 */
	public function get_rewrite_rules( $marker = true ) {
		$webp_dir       = new Webp_Dir();
		$upload_relpath = $webp_dir->get_upload_rel_path();
		$webp_path      = trailingslashit( $webp_dir->get_webp_path() );
		$webp_rel_path  = trailingslashit( $webp_dir->get_webp_rel_path() );

		$base       = trailingslashit( dirname( $upload_relpath ) );
		$directory  = trailingslashit( basename( $upload_relpath ) );
		$regex_base = ltrim( $base, '/\\' ) . '(' . $directory . ')';
		$regex_base = str_replace( '/', '\/', $regex_base );

		/**
		 * We often need to remove WebP file extension from Nginx cache rule in order to make Smush WebP work,
		 * so always add expiry header rule for Nginx.
		 *
		 * @since 3.9.8
		 * @see https://incsub.atlassian.net/browse/SMUSH-1072
		 */

		$code = <<<WEBP_RULES
        location ~* "{$regex_base}(.*\.(?:png|jpe?g))" {
            add_header Vary Accept;
            set \$image_path \$2;
            if (-f "{$webp_path}disable_smush_webp") {
                break;
            }
            if (\$http_accept !~* "webp") {
                break;
            }
            expires	max;
            try_files {$webp_rel_path}\$image_path.webp \$uri =404;
        }
        WEBP_RULES;

		if ( true === $marker ) {
			$code  = "# BEGIN SMUSH-WEBP\n" . $code;
			$code .= "\n# END SMUSH-WEBP";
		}
		return apply_filters( 'smush_nginx_webp_rules', $code );
	}
}