Skip to content

Instantly share code, notes, and snippets.

Forked from tonyjunkes/nginx.conf
Last active November 16, 2020 01:36
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Server portion for setting up a proxy to Lucee with rewrite to have index.cfm omitted for SES.
http {
server {
listen 80;
root /var/www/;
index index.cfm;
set $lucee_context "";
autoindex on;
location / {
# Rewrite rules and other criterias can go here
# Remember to avoid using if() where possible (
try_files $uri $uri/ @rewrites;
# 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";
location @rewrites {
# Can put some of your own rewrite rules in here
# for example rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
rewrite ^/(.*)? /index.cfm/$1 last;
#block requests for Application.cfc/cfm
location ~*[mc]$ {
return 404;
location ~* /lucee-server {
return 404;
#block/ignore CFIDE requests
location ~* /CFIDE {
return 404;
location ~* /lucee/ {
deny all;
# Main Lucee proxy handler
location ~ \.(cfm|cfml|cfc|jsp|cfr)(.*)$ {
set $path_info $request_uri;
proxy_read_timeout 100s;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header https $cgi_https;
proxy_set_header X-Tomcat-DocRoot $document_root;
proxy_set_header X-ModCFML-SharedKey 8DoB0PzqdMn4zo0Y2bq7dzqynbqBVsK0piuNslpNU6982KaiCqVT8X;
proxy_set_header X-Webserver-Context $lucee_context;
#proxy_set_header XAJP-PATH-INFO $pathinfo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment