Sample Adaptive Framework configuration file
/* Adaptive framework configuration. */
[
// File adaptor for accessing configuration.
{
type : "adaptor",
adaptorId : "conf",
adaptorType : "file",
filenameSuffix : ".json",
contentType : "json",
root : "/var/lib/afw/config/"
},
{
type : "requestHandler",
uriPrefix : "/xacml",
requestHandlerType : "xacml"
},
// catch all for /
{
type : "requestHandler",
uriPrefix : "/",
requestHandlerType : "adaptor"
},
{
type : "application",
confAdaptorId : "conf",
applicationId : "MyApplication"
}
]
Sample Nginx Configuration
worker_processes 1;
env HOMEPATH;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/json;
log_format simple_format '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent';
server {
listen 8080;
client_max_body_size 100M;
access_log /dev/stdout simple_format;
error_log /dev/stdout;
location /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
root /var/www/html/;
location = / {
return 301 $scheme://$http_host/afw_app/Home;
}
location ~ /afw_app/(.+) {
root /var/www/html/afw_app/;
try_files /$1 /$1/index.html /index.html =404;
}
location = /docs {
return 301 $scheme://$http_host/docs/index.html;
}
location ~ /docs/(.+) {
root /var/www/html/afw_app/docs;
try_files /$1 /$1/index.html =404;
}
location / {
fastcgi_pass unix:/tmp/afw.sock;
fastcgi_param IGNORE_URI_PREFIX /;
fastcgi_param URI $uri;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
fastcgi_param SCHEME $scheme;
fastcgi_param TIME_ISO8601 $time_iso8601;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
}
}
Sample systemd Startup Script for afwfcgi
[Unit]
Description=Adaptive Framework FCGI systemd service script
[Service]
Type=simple
ExecStart=/usr/local/bin/afwfcgi -n 10 -p /var/run/afw.sock -f /etc/afw.conf
ExecStartPost=/bin/sleep 2
ExecStartPost=/usr/bin/chown nginx:nginx /var/run/afw.sock
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target