Skip to content

Instantly share code, notes, and snippets.

@robertz
Created July 21, 2012 02:02
Show Gist options
  • Save robertz/3154238 to your computer and use it in GitHub Desktop.
Save robertz/3154238 to your computer and use it in GitHub Desktop.
Railo/ACF Template for Nginx
server {
listen 80;
server_name example.com;
root /var/www/example.com;
access_log /var/log/exmaple.access.log;
error_log /var/log/example.error.log;
location / {
# Rewrite rules and other criterias can go here
# Remember to avoid using if() where possible (http://wiki.nginx.org/IfIsEvil)
try_files $uri $uri/ @rewrites;
}
location ~* /railo-context/admin/ {
internal;
proxy_pass http://127.0.0.1:8888;
}
location ~* /secret/location/ {
rewrite ^/secret/location/(.*)? /railo-context/admin/$1;
}
location @rewrites {
# Can put some of your own rewrite rules in here
# for example rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
rewrite ^/(.*)? /index.cfm/$1 last;
rewrite ^ /index.cfm last;
}
# This block will catch static file requests, such as images, css, js
# The ?: prefix is a 'non-capturing' mark, meaning we do not require
# the pattern to be captured into $1 which should help improve performance
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# We can include our basic configs here, as you can see its much easier
# than pasting out the entire sets of location block each time we add a vhost
include drop.conf;
include railo.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment