文档

CloudPanel 托管的配置

If you are using a hosting managed by CloudPanel (Hosting Control Panel), please follow the steps below for the Xilifox Image Optimizer plugin to work properly.

  • 步 1.#

    Log in to your CloudPanel dashboard and go to the “Sites” tab.

  • 步 2.#

    Find your website and click the “Manage” button.

  • 步 3.#

    Go to the “Vhost” tab.

  • 步 4.#

    In the “Vhost Editor” field you will need to add additional Nginx rules required by our plugin. Add new rules before the rewrite ... and the location { ... } directives:

    In the space marked in the screenshot above, add the following rules:

    # BEGIN XIO
    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;
    add_header Cache-Control "private";
    expires 365d;
    try_files
    /wp-content/uploads-xio/$path.$ext$ext_avif
    /wp-content/uploads-xio/$path.$ext$ext_webp
    $uri =404;
    }
    # END XIO

  • 步 5.#

    Click the “Save” button to save your Nginx configuration changes:

  • 步 6.#

    就这样! The error on the plugin settings page should disappear.

不是您正在寻找的解决方案?

请检查其他 文章 或打开一个 工单.