Monthly Archives: July 2012

Nginx connector for Railo/ACF part deux


Edit: This post is now outdated. See this post: https://kisdigital.wordpress.com/2013/03/04/my-final-nginxrailo-connector/

Almost a year ago I posted about an improved connector for nginx proxy to Railo. While I consider myself fortunate moving from Apache over to nginx, it is rather unfortunate that I did not have the time to really test my server setup and understand what was happening under the hood. Then I posted it.

Six months or so ago I drifted away from personal development. My family and work demand much of my attention and I don’t have a lot of “extra” time, but lately I have been trying to spend more time learning new things. As a web developer if your server stack is not solid you are going to be in bad shape so I figured it would be a good time to go back and revisit this.

I thought it would be best to look around and see what folks a lot smarter than me were doing which brought me to KBeezie’s Nginx configuration examples and it was a lot of help. My new server template is based off of his examples, I also went and did some digging in the Railo user group. Special thanks to Serge Droganov in the Railo group  for pointing me the right direction getting the administrator locked down.

This is my default new site template. First we have the default handler that looks to see if the URI exists, if not it looks at the rewrite rules to see if there is a match. If not I want to just load the default document. Here the rewrite rules are enabled SES URLs for the server that will work both with and without the index.cfm in the url (i.e., http://example.com/cool/page or http://example.com/index.cfm/cool/page). My preference leans toward SES URLs because they are much cleaner, but you know what they say about opinions. Standard URLs will work just fine as well.

Second I am hiding the Railo Administrator as it just makes sense. Adding the “internal;” directive to /railo-context/admin/ tells Nginx that you do not want to world to get to it, only rewrites coming from another rewrite rule on the server should be allowed.

Next I am moving my Railo Administrator to http://example.com/secret/location/(server|web).cfm. I was going to try to get a little bit fancier with it, but it works well. Since this is an internal rewrite, we are allowed to pass through to the administrator.

Finally we have the @rewrites named location block that is used by our default handler. If the page being requested does not exist it will try to find a match among these rewrite rules and dispatch the request. These can be built upon later to do some interesting things, but by default it just handles serving the SES urls.

The rest of the directives here describe how to handle static content and what URIs you want dropped automatically such as configuration files, directories, etc which are described in the dropped.conf file. I also included the railo.conf at the bottom of the file which handles passing off ColdFusion files to the app server. It has not changed much from my original post, but I will include it here anyway.

The only changes here are moving the railo-context code out and just keeping it in the server configuration blocks.

I definitely suggest you check out KBeezies. A lot of it is targeted towards PHP, but quite a bit of it is applicable to A/CF and also the Nginx Wiki.

Advertisements

Modifying the jQuery dump plugin to not open in a new window


I have been using the jQuery version of the javascript dump for a while now and it is invaluable especially when debugging JSON objects.  The one down side to the plugin is it tries to display the dump contents in a new window, but I prefer to just get the html contents and stuff it into a div.

As it turns out it was pretty easy to modify the plugin to work how I wanted. To make the collapse/expand feature work I had to make the functions global but it is cool as long as you don’t have any functions on the page with the same name.

Here is an example page:

The dump results:

If you would like check out the dump plugin, here is my modified jqDump.js file.