文档

Nginx 代理的配置

If you are using a Nginx server that supports .htaccess rules, but you still have a server configuration error on the plugin settings page, additional Nginx server configuration is required for the Xilifox Image Optimizer plugin to work properly. This indicates a problem with Nginx Reverse Proxy for static files or Nginx Caching for static files.

  • 步 1.#

    Start an SSH connection to your website or forward this instruction to your server administrator.

  • 步 2.#

    Find the configuration file in one of the paths (remember to select configuration file used by your domain):

    • /etc/nginx/sites-available/ 或者 /etc/nginx/sites-enabled/
    • /etc/nginx/conf.d/
  • 步 3.#

    Check if you have similar rules in your configuration file for your domain (the list of extensions in the location directive may vary, so look for similarities):

    location ~* ^.+.(css|js|jpg|jpeg|png|gif|webp|ico|eot|otf|woff|woff2|ttf)$ {
    expires max;
    ...

    或者

    location ~* ^.+.(css|js|jpe?g|png|gif|webp|ico|eot|otf|woff|woff2|ttf)$ {
    expires 1M;
    try_files $uri @proxy;
    ...

    Depending on the configuration, these rules may be located in a different configuration file if the configuration is divided into several files.

    If you find such rules, please remove the following formats from the location directive:

    • jpgjpeg 或者 jpe?g
    • png
    • gif
    • webp

    This is what an example location directive looks like before the change:

    This is what the same directive looks like after the change:

  • 步 4.#

    Restart the Nginx server using the command:

    systemctl restart nginx

  • 步 5.#

    就这样! Our plugin will work properly.

     

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

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