Hi everyone,
I’m running a VPS setup on DigitalOcean for a project that’s pretty image-heavy. The site showcases hairstyle and fashion content, and some pages (like textured fringe haircut) have a lot of high-quality photos.
I’m worried about performance as traffic grows. So far I’ve:
Enabled basic caching with Nginx
Compressed images with TinyPNG
Set up a CDN, but I’m not sure if it’s configured optimally
My questions are:
What’s the most effective way to balance high-resolution photos with fast page loads?
Is there a VPS-level configuration tweak (NGINX, Apache, MySQL) that helps the most with image-heavy sites?
Any recommendations for image formats (WebP, AVIF, etc.) that work best without losing too much quality?
Would love to hear how others optimize sites like this — thanks in advance!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
Great setup so far! Image-heavy sites definitely need careful optimization. Here’s how to tackle each area:
Responsive images are your best friend:
<picture>
elements or srcset
to serve different sizes based on device/viewportLazy loading:
loading="lazy"
for images below the foldProgressive enhancement:
Nginx optimizations (most impactful):
# Enable gzip for images (though limited benefit)
gzip_types image/svg+xml;
# Critical: Set proper cache headers
location ~* \.(jpg|jpeg|png|webp|avif)$ {
expires 1y;
add_header Cache-Control "public, immutable";
add_header Vary "Accept-Encoding";
}
# Enable HTTP/2 for parallel loading
listen 443 ssl http2;
# Increase client body size for uploads
client_max_body_size 50M;
Server-level tweaks:
worker_connections
in nginx (try 2048-4096)keepalive_timeout
(around 30-65 seconds)mod_expires
and mod_deflate
Database (if storing image metadata):
Format hierarchy (best to fallback):
Implementation strategy:
<picture>
<source srcset="image.avif" type="image/avif">
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="Textured fringe haircut" loading="lazy">
</picture>
Quality settings I’d recommend:
CDN optimization:
Consider image processing services:
Monitoring:
For a fashion/hairstyle site, users expect beautiful imagery, so the progressive loading approach works really well - they see something immediately, then get the full quality. The format fallback strategy ensures everyone gets a good experience regardless of browser support.
What CDN are you currently using? That might inform some specific optimization recommendations.
Retry
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.