After we have fastcgi working for Catalyst, we then need a proxy http service to actually to the page response work. There are a number of solutions available to handle this but recently I have been messing with nginx. nginx is a fastcgi compatible web server designed specifically for speed and quickness. While nowhere near as feature complete as Apache, it provides enough functionality to host some very large, vary busy web service companies.
In the interest of total disclosure, a fairly significant portion of the information I am provided I gleaned off an outstanding tutorial by Richard Wallman. Basically you need to create a new server instance config file for your new nginx application proxy. Open a text editor as root and create a new file /etc/nginx/config.d/mynewserver.conf and add following:
server {
server_name app.mysite.org;
# Let’s have a server alias as wellaccess_log /var/log/nginx/mysite.access.log;
root /usr/share/nginx/html;# Serve static content statically
expires +30d;
location /static {
add_header Cache-control public;
root /usr/share/nginx/html/root/;
}# We pass the rest to our FastCGI application server
location / {
# We also set some headers to prevent proxies
add_header Pragma “no-cache”;
add_header Cache-control “no-cache, must-revalidate, private, no-store”;
expires -1s;# Where our FastCGI app server is listening
fastcgi_pass 127.0.0.1:8100;include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_NAME /;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}
If the line with fastcgi_pass is the same as the fastcgi ip address then you should be in good shape. The other thing to notice about the configuration above tis the location /static this forwards requests for static content directly through nginx without using cgi. This creates less overhead and faster responses for things like images, css, and javascript.
More later, my kids are in the middle of a mean rendition of chop sticks.