CMD_UNIT: Nginx Unit for other handlers (SKINS)(TEMPLATES)

Version 1.62.0


BETA This feature is part of the "DirectAdmin Pro Pack" ==== CMD_UNIT Nginx Unit allows for mid-level processing, after the webserver accepts the requests, but can redirect the request with immense control, before it actually hits the disk. =============================== FILES /usr/local/directadmin/data/users/USERNAME/domains/DOMAIN.COM.unit/APP.json /usr/local/directadmin/data/users/USERNAME/domains/DOMAIN.COM.routes/domain|SUB.domain used only for local storage, and to re-fill the live unit daemon. The "live" data is stored/managed in the unit deamon. =============================== TEMPLATES /usr/local/directadmin/data/templates/unit_apps.json /usr/local/directadmin/data/templates/unit_routes.json These 2 templates are just pre-fill values for Users to pick from. Manual editing of raw json is still allowed in the GUI. =============================== =============================== REQUESTS -------- LIST Listing all unit apps and routes: CMD_UNIT? JSON: returns json, with "applications" array. Each app index is the app name, eg "test", and the json data within that app is the data from the domains/$NAME.json Note: Numbers are currently shown as string, eg: "timeout": "10" which is set to be fixed such that the container supports actual numbers. "rotues" array[] list is also returned. Will be either: and/or: where "subdomain" values are allowed route routes specific to that subdomain. Routes applies to a domain are not applied to that subdomain. ============ APPLICATIONS -------- CREATE APP Creating an nginx unit app Method: POST CMD_UNIT action=create name=appname #saved as "domain.com_appname" in unit json={ ... your app ... } -------- MODIFY Modify an existing nginx unit app Method: POST action=modify name=appname json={ ... your app ... } -------- DELETE Method: POST CMD_UNIT json=yes action=select select0=app1 (select1=app2) DirectAdmin does not check if the app json file currently exists, in case you're attempting to purge a left-over app from curl, which could be out of sync with the files. ============ ROUTES -------- LIST ROUTES Listing all unit apps and routes: CMD_UNIT? -------- ROUTE CREATION STEPS 'GET' the items available to create with: CMD_UNIT? CMD_UNIT? will return; da_settings["applications"] as a list of all currently available unit apps. da_settings["actions"] as a list of possible action (pass,proxy,return,share), with a brief description as each value. route[] the json route currently set for this domain or domain+subdomain. If nothing yet, it will be []. -------- CREATE ROUTE CMD_UNIT method: POST action=set_route (subdomain=sub :optional is saving for a subdomain) routes=[ the json list of matches/actions for this route ] The "routes" data must be assembled json, as defined here: eg routes= [ { "match": { "uri": "/v2_site/*" }, "action": { "pass": "applications/test.com_php" } }, { "match": { "uri": "/" }, "action": { "return": 301, "location": "" } }, { "action": { "proxy": "" } } ] The DirectAdmin back-end recursively parses and validates all aspects of the json to prevent cross-user/domain app calls or shared paths not belonging to this User. -------- DELETE ROUTES CMD_UNIT method: POST json=yes action=select_routes (even if deleting a sub.domain route, use "" here) ( DA will attempt to clear the route from the unit socket first. If it fails, the local json file will not be removed. If it failed due to the route not existing, the local json file WILL be removed. ==== TODO packages/reseller/user.conf switches directadmin.conf option to disable unit modules, eg: unit_modules=perl:php:etc.. Access Logs for unit. =============================== TASK.QUEUE For a full rewrite of all Unit settings, the dataskq can do it via task.queue file: echo "action=rewrite&value=nginx_unit" >> /usr/local/directadmin/data/task.queue =============================== SKINS files_users.conf: CMD_UNIT_CREATE=user/app/app_create.html CMD_ROUTE_EDIT=user/app/route_edit.html CMD_UNIT=user/app/apps.html also file for viewing all apps, and editing a given app with auto-fill. (Make use of HTM insertion to re-use the same form html file for create and edit) However, we recommend using dynamic json, as Evolution does. The above is only a basic raw textarea json method to control it and does not include the templates like Evo does. ==== EVO1985

Try DirectAdmin with a 30-day money back guarantee!