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.
-
Step 1.#
Start an SSH connection to your website or forward this instruction to your server administrator.
-
Step 2.#
Find the configuration file in one of the paths (remember to select configuration file used by your domain):
/etc/nginx/sites-available/
or/etc/nginx/sites-enabled/
/etc/nginx/conf.d/
-
Step 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;
...
or
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:
jpg
andjpeg
orjpe?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:
-
Step 4.#
Restart the Nginx server using the command:
systemctl restart nginx
-
Step 5.#
That’s all! Our plugin will work properly.