Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ArakaTech

    (@arakatech)

    Here the entire nginx conf;

    server {
    
    		# BEGIN Converter for Media
    		set $ext_avif ".avif";
    		if ($http_accept !~* "image/avif") {
    		set $ext_avif "";
    		}
    
    		set $ext_webp ".webp";
    		if ($http_accept !~* "image/webp") {
    			set $ext_webp "";
    		}
    
    		location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ {
    			add_header Vary Accept;
    			expires 365d;
    			try_files
            /wp-content/uploads-webpc/$path.$ext$ext_avif
            /wp-content/uploads-webpc/$path.$ext$ext_webp
            $uri =404;
    		}
    		# END Converter for Media
    		
    		listen 80;
            listen 443 ssl http2;
            ssl_certificate /etc/ssl/mydomain.com/mydomain.com.crt;
            ssl_certificate_key /etc/ssl/mydomain.com/mydomain.com.key;
            root /var/www/html/mydomain.com;
            index index.php index.html index.htm;
            error_log /var/log/nginx/mydomain.com.error.log;
            server_name mydomain.com www.mydomain.com;
            location / {
    
                    try_files $uri $uri/ /index.php?$args;
            }
            if ($http_user_agent ~* (MJ12bot|SemrushBot|GrapeshotCrawler|BLEXBot|AhrefsBot|DotBot) ) { return 301 http://127.0.0.1/; }
            location ~* /(?:uploads|files)/.*\.(asp|bat|cgi|htm|html|ico|js|jsp|md|php|pl|py|sh|shtml|swf|twig|txt|yaml|yml|zip|gz|tar|bzip2|7z)$ { deny all; }
            location ~ \.php$ {
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    fastcgi_pass unix:/run/php/php7.4-mydomain.com-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }
            location = /wp-login.php {
                    limit_req zone=limit burst=1 nodelay;
                    limit_req_status 429;
                    fastcgi_pass unix:/run/php/php7.4-mydomain.com-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
            location = /robots.txt {
                    try_files $uri $uri/ /index.php?$args;
                    allow all;
                    log_not_found off;
                    access_log off;
            }
            location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|ttf|otf|woff|svg)$ {
                    expires 365d;
            }
    
                   include fastcgi_params;
            }
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
            location = /robots.txt {
                    try_files $uri $uri/ /index.php?$args;
                    allow all;
                    log_not_found off;
                    access_log off;
            }
            location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|ttf|otf|woff|svg)$ {
                    expires 365d;
            }
            location ~ /\.ht {
                    deny all;
            }
            location ~ /\.us {
                    deny all;
            }
            location = /xmlrpc.php {
                    return 403;
            }
            rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
            rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    
    }

    thats all.
    so how to fix Server configuration error ” Error codes: rewrites_cached “??

    thanks

    Thread Starter ArakaTech

    (@arakatech)

    Hello @mateuszgbiorczyk

    Can you show me the example what you mean on extra rules for image files?

    by the way, how to resolve the problem ?? Sorry, you haven’t provided a solution yet

    Thread Starter ArakaTech

    (@arakatech)

    Hello @mateuszgbiorczyk

    The nginx not support .htaccess i think. no panel used here.

    and any rules configuration according to the plugin is placed correctly like in the FAQ-Configuration for Nginx:

    i put rule like below:

    server {

    # BEGIN Converter for Media
    set $ext_avif ".avif";
    if ($http_accept !~* "image/avif") {
        set $ext_avif "";
    }
    
    set $ext_webp ".webp";
    if ($http_accept !~* "image/webp") {
        set $ext_webp "";
    }
    
    location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ {
        add_header Vary Accept;
        expires 365d;
        try_files
            /wp-content/uploads-webpc/$path.$ext$ext_avif
            /wp-content/uploads-webpc/$path.$ext$ext_webp
            $uri =404;
    }
    # END Converter for Media

    and the rule for MIME Types have been checked also.
    using /etc/nginx/mime.types

    image/webp webp;

Viewing 3 replies - 1 through 3 (of 3 total)