Documentation

Visit Our xCloud Knowledge Base

Here is your one-stop source for in-depth articles, FAQs, and tutorials for you to excel at hosting & managing your websites.


How to Enable WebP For NGINX Server With xCloud

WebP is a modern image format developed by Google that offers superior compression for images on the web, helping improve site load times without compromising quality. Enabling WebP support on your server ensures that browsers capable of displaying WebP images will automatically receive them, while others continue to receive standard PNG or JPEG formats.

Learn how to enable and configure WebP for NGINX server with xCloud to serve WebP images efficiently.

Step 1: Go to The NGINX Customization  #

To begin, log into your xCloud dashboard and navigate to the site where you want to enable WebP support. From the left-hand menu, click on โ€˜Toolsโ€™ and then select โ€œNGINX Customization.โ€ This section allows you to safely modify server configurations.

Enable Webp For NGINX

Step 2: Add the Config Content for Before Server Block #

The first step is to add a custom configuration before the server block. Click the โ€œAdd a New Configโ€ button, and when the popup appears, set the Config Type to Before Server Block. Name the configuration something descriptive. Then, in the Config Content field, paste the following code:

before:

map $http_accept $webp_suffix {

ย ย ย ย default "";

ย ย ย ย "~*webp" ".webp";

}

After pasting the code, click the โ€œSave Configโ€ button to apply the changes.

Enable Webp For NGINX

Step 2: Add the Config Content for Inside Server Block #

Next, youโ€™ll need to handle how NGINX serves WebP images by modifying the configuration โ€˜Inside the Server Blockโ€™. Again, click โ€œAdd a New Configโ€, and this time select Inside Server Block for the Config Type. Give this a configuration file name then paste the following into the Config Content field:

Inside:

location ~* ^.+\.(png|jpe?g)$ {

ย ย ย ย add_header Vary Accept;

ย ย ย ย try_files $uri$webp_suffix $uri =404;

}

Then, click the โ€œSave Configโ€ button to apply the changes. Once this second configuration is saved, your server is ready to start serving WebP images automatically when possible.

Enable Webp For NGINX

And thatโ€™s it. This is how easily you can enable WebP for NGINX server with xCloud. With this, your xCloud server is now optimized to serve WebP images to supported browsers, improving site performance and efficiency.ย 

Still stuck? Contact our support team for any of your queries.ย 

What are your feelings
Updated on April 17, 2025

Server Name

RAM

SSD

xCloud Provider Price/m
(For LTD users)

VULTR Price/m

DO Price/m

Newcomer

1GB

25GB

$4.50

$5.00

$6.00

Basic

2GB

55GB

$9.00

$10

$12.00

Standard

4GB

80GB

$18.00

$20

$24.00

Professional

8GB

160GB

$36.00

$40

$48.00

Business

16GB

320GB

$72.00

$80

$96.00

Server Name

RAM

SSD/NVMe

xCloud Provider Price/m
(For LTD users)

VULTR Price/m

DO Price/m

Lite

1GB

32GB

$5.40

$6.00

$8.00

Personal

2GB

88GB

$16.20

$18.00

$24.00

Growing

4GB

128GB

$21.60

$24.00

$32.00

Elite

8GB

256GB

$43.20

$48.00

$64.00

Titanium

8GB

384GB

$86.40

$96.00

$96.00

Ultimate

32GB

512GB

$172.80

$192.00

$192.00