Railgun is a single daemon that runs on a 64-bit system which uses alternative compression techniques to dramatically speed up WAN performance. It proxies traffic through a special protocol that would normally travel between CloudFlare and your origin server over HTTP.
This cuts down on bandwidth, transfer time, and overall page load times.
Before proceed, please contact cloudflare and get activation code
Ubuntu Linux 10.04, 11.10, 12.04 & 12.10
FreeBSD 8 & 9
Red Hat Enterprise Linux 5 & 6
CentOS 5 & 6
mod_cloudflare, an Apache module which displays a visitor’s true source IP, should update the mod_cloudflare configuration to include the IP of your Railgun instance as a trusted proxy. If Apache and Railgun run on the same server, the following line is needed within your mod_cloudflare configuration:
If apache and railgun are on two server, then add the settings.
CloudFlareRemoteIPTrustedProxy <remote ip>
Enable port 2408 on your firewall and allow cloudflare ips.
# for i in `curl https://www.cloudflare.com/ips-v4`; do ufw allow proto tcp from $i to any port 2408; done # for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -s $i --dport 2408 -j ACCEPT; done
Open your railgun configuration file and activate
activation.token <activation code>
activation.public_ip <server ip>
[email protected] [~]# /etc/init.d/railgun start
Starting railgun: [ OK ]
Railgun successfully backgrounded, ensuring proper startup… [ OK ]
[email protected] [~]# netstat -plnt | grep 2408
tcp 0 0 :::2408 :::* LISTEN 19631/rg-listener
To make sure that activation works properly, check your logs for a successful activation response when starting Railgun:
$ tail -f /var/log/messages
Oct 27 22:29:41 www railgun[Activation]: Activation POST completed.
Oct 27 22:29:41 www railgun[Activation]: Assigned Railgun ID: 1
Oct 27 22:29:41 www railgun[Activation]: Acquired cert from server
If you have any problem to work railgun, please make sure you have activate service on cloudflare control panel.