I built my own CDN with Varnish and Nginx
11 hours ago
- #CDN
- #Varnish
- #Nginx
- Author built a custom CDN using Varnish and Nginx due to frustrations with commercial CDN services.
- Main reasons for building a custom CDN included ownership, cost savings, learning, and better cache hit rates.
- Used Leaseweb for hosting due to inexpensive global server options and fast NVMe storage.
- Chose Debian stable, Nginx, and Varnish configured for disk storage to optimize caching.
- Initial setup included three servers in Frankfurt, Los Angeles, and Singapore.
- Encountered challenges with SSL certificate synchronization across servers, solved with a push strategy using rsync.
- Used Bunny's DNS service for geolocation-based routing due to ease of use.
- Performance improved with higher cache hit rates (55% and climbing) compared to commercial services.
- Cost comparison showed similar expenses (~$90/month) but with added maintenance and customization benefits.
- Future plans include expanding server locations, hosting own georouting DNS, and enhancing WAF capabilities.