External Web Server
You can place CommandBox downstream behind another external web server if you wish. Here is an overview of how to do that.

Microsoft IIS

Apache HTTP

Nginx

1
server {
2
3
server_name example.net www.example.net;
4
5
root /app;
6
7
index index.cfm index.html index.htm;
8
9
proxy_redirect off;
10
proxy_set_header X-Real-IP $remote_addr;
11
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
12
proxy_set_header Host $http_host;
13
proxy_set_header X-Forwarded-Proto $scheme;
14
15
location ~ /WEB-INF/ { access_log off; log_not_found off; deny all; }
16
location ~ /META-INF/ { access_log off; log_not_found off; deny all; }
17
location ~ /META-INF/ { return 404; }
18
location ~ /WEB-INF/ { return 404; }
19
location ~ \.config$ { return 404; }
20
location ~ /\. { return 404; } ## e.g. .htaccess, .gitignore etc.
21
location ~ ~$ { return 404; }
22
location ~ \.aspx?$ { return 404; } ## most likely hackers testing the site
23
location ~ \.php$ { return 404; }
24
25
# this prevents hidden files (beginning with a period) from being served
26
location ~ /\. {
27
access_log off; log_not_found off; deny all;
28
}
29
30
# Do not log missing favicon.ico errors
31
location ^/(favicon\.ico|apple-touch-icon.*\.png)$ {
32
access_log off; log_not_found off;
33
}
34
location = /robots.txt {
35
access_log off; log_not_found off;
36
}
37
38
location / {
39
try_files $uri $uri/ @rewrites;
40
}
41
42
#set indexfileinurls=0 in Mura's settings.ini.cfm
43
location @rewrites {
44
rewrite ^/(.*)? /index.cfm/$1 last;
45
rewrite ^ /index.cfm last;
46
}
47
48
# Main Railo/Lucee proxy handler
49
location ~ \.(cfm|cfml|cfc|jsp|cfr)(.*)$ {
50
proxy_pass http://127.0.0.1:8080;
51
}
52
53
# Some basic cache-control for static files to be sent to the browser
54
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm|js|css)$ {
55
expires 1M;
56
#expires modified +90d;
57
access_log off;
58
add_header Pragma public;
59
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
60
}
61
62
listen [::]:443 ssl http2 ipv6only=on; # managed by Certbot
63
listen 443 ssl http2; # managed by Certbot
64
ssl_certificate /etc/letsencrypt/live/example.net/fullchain.pem; # managed by Certbot
65
ssl_certificate_key /etc/letsencrypt/live/example.net/privkey.pem; # managed by Certbot
66
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
67
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
68
69
}
70
71
server {
72
73
if ($host ~ ^[^.]+\.example\.net$) {
74
return 301 https://$host$request_uri;
75
} # managed by Certbot
76
77
if ($host = example.net) {
78
return 301 https://$host$request_uri;
79
} # managed by Certbot
80
81
82
listen 80;
83
listen [::]:80;
84
server_name example.net www.example.net;
85
return 404; # managed by Certbot
86
87
}
Copied!
Last modified 1yr ago