One of the recommended ways to improve website performance is to configure file compression and caching.
- Compression is used to transfer static files - javascript, css styles, fonts, and more. With compression enabled, the web server transmits the files in compressed form, and adds the Content-Encoding header
![3.How to enable caching and compression of static files](http://realhost.pro/data/posts/IzuFEo7D.png)
- When caching is enabled, the server sends the Expires header, which tells the browser that the downloaded file can be saved in the cache. When re-accessing the file, the browser will not download it, but will take it from the cache. Client-side caching applies to javascript, css files, images and other static files. This feature increases the speed of loading and displaying the site in the browser significantly.
![5.How to enable caching and compression of static files](http://realhost.pro/data/posts/nm7ejQkD.png)
For any site, the optimal configuration of compression and caching of static files is already defined by default.
Sample nginx config:
However, if you need more precise customization, you can override the types of static files for which this configuration will be applied. For this:
The setting should be done in the PHP hosting control panel https://php.realhost.pro:8083
1. Select a domain in the WEB section
![12.How to enable caching and compression of static files](http://realhost.pro/data/posts/g01EEpPx.png)
2. Click the "More options" button
![14.How to enable caching and compression of static files](http://realhost.pro/data/posts/I2IQpWYU.png)
3. In the "Proxy Processing" field, specify the list of file types for caching
![16.How to enable caching and compression of static files](http://realhost.pro/data/posts/tlP0Xyau.png)
4. When finished, click the "Save" button
![18.How to enable caching and compression of static files](http://realhost.pro/data/posts/Yxbqffyc.png)