If you are asking this question, then you have started to optimize the site. The Google PageSpeed Insights service shows how much the loading of your site is optimized according to the "corporation of goodness" algorithms.
PageSpeed Insights indexes are influenced by several factors, we will tell you how to enable caching and compression, thereby increasing the index to 70-90 points .
And so, open the .htaccess file in the root of the site on Opencart and add the following code to the end:
# Enable cache in visitor browsers
<ifModule mod_headers.c>
# All html and htm files will be stored in the browser cache for one day
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
# All css, javascript and text files will be stored in the browser cache for one week
<FilesMatch "\.(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# All flash files and images will be stored in the browser cache for one month
<FilesMatch "\.(flv|swf|ico|gif|png|jpg|jpeg)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
# Disable caching of php and other service files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
#gzip compression
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>