README.md 1.38 KB
Newer Older
Jan Grewe's avatar
Jan Grewe committed
1
2
3
4
5
6
7
8
9
10
11
Photon
=========

Photon is an image acceleration and modification service (for Jetpack-connected WordPress sites). You can run your own Photon-based CDN for any other (non-Wordpress sites) by using the open source Photon code to grab all images from your site and caching them with Varnish.

Quick & Dirty Instructions:

  - Create a new Apache vHost (e.g. ServerName cdn.example.com)
  - Make that vHost also respond on a wildcard subdomain (ServerAlias cdn*.example.com)
  - Configure Apache to use port 81 
  - Configure Varnish to use port 80 
12
  - Check the included vHost config ('examples/vhost.conf') if you plan on using HTTPS
Jan Grewe's avatar
Jan Grewe committed
13
14
15
16
17
18
19
  - Use the included Varnish VCL ('examples/varnish.vcl') for caching all images for 1 week if the request was made to one of the CDN hosts
  - Put all files into the DocumentRoot of the vHost you created
  - Make sure mod_rewrite is enabled (a2enmod rewrite) and that you are allowed to use the .htaccess file in the DocumentRoot of the vHost (AllowOverride All)

If that's all running, take the address of some image on your site (e.g. http://www.example.com/img/photo.jpg) and prefix it with one of your CDN hosts (e.g. http://cdn0.example.com/www.example.com/img/photo.jpg). 

If everything's working fine, your should not only get the image, but also see in the HTTP headers that Varnish has cached the image (X-Cache: HIT) and won't ask the origin for it again (for a week).