Your server uses a popular set of software in the form of Control Panel ISPManager, Apache Web Server and nginx as the www-accelerator?
Please note that the nginx does not give headlines Expires.
If the PHP-generated documents is not always essential, it is desirable to give the static data with a similar title, allowing browsers visitors more actively use the cache.
There are two versions of how to extradite Expires header.
If you have a few sites in the text editor, open nginx.conf (in Linux-systems, it is usually located in /etc/nginx/, in FreeBSD – /usr/local/etc/nginx/), find the configuration unit server {} for your virtual host. In this configuration block has a section for handling static location Other office. It is in this section, add the line expires Xd, where X - the number of days of data validity. For example, expires 7d tells the browser that the images and CSS/JS files can be cached for a week.
Eventually you location the block will look like this:
1 2 3 4 5 6 7 |
location ~* ^.+.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ { root /var/www/username/data/www/usernamesite.ru; access_log /var/www/nginx-logs/usernamesite isp; access_log /var/www/httpd-logs/usernamesite.ru.access.log ; error_page 404 = @fallback; expires 7d; } |
The second way - to teach panel indicate the option expires statics on all virtual servers with nginx configuration file. To do this, create a file /usr/local/ispmgr/etc/server.templ with the following content:
1 2 3 |
location ~* ^.+.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ { expires 7d; } |
Restarting the panel (killall ispmgr), create a new Website ISPManager through and check that the option expires correctly specified herein freshly created website in nginx.conf file.
No Comment
You can post first response comment.