> For the complete documentation index, see [llms.txt](https://commandbox.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://commandbox.ortusbooks.com/embedded-server/server-json.md).

# Server.json

Every time you start a server, the settings used to start it are saved in a `server.json` file in the web root. Any parameters that aren't supplied to the `start` command are read from this file (if it exists) and used as defaults. Here are the possible properties for a `server.json` file:

`/server.json`

```javascript
{
    "name": "",
    "openBrowser": true,
    "openBrowserURL": "http://localhost/admin/login",
    "startTimeout": 240,
    "stopsocket": 50123,
    "debug": false,
    "trace": false,
    "console": false,
    "profile": "prod",
    "dockEnable": true,
    "trayEnable": true,
    "trayicon": "/path/to/trayicon.png",
    // Used for host-updater module, but not for bindings
    "hostAlias": "site.com",
    "env": {
        "ANYTHING_HERE": "you want",
        "THESE_ARE_ADDED": "As environment variables to the server"
    },
    "trayOptions": [
        {
            "label": "Foo",
            "action": "openbrowser",
            "url": "http://${runwar.host}:${runwar.port}/foobar.cfm",
            "disabled": false,
            "image": "/path/to/image.png"
        },
        {
            "label": "Open VScode",
            "action": "runAsync",
            "command": "code .", // Command is run relative to webroot, for box commands begin command with `box`
            "disabled": false,
            "image": "/path/to/image.png"
        },
        {
            "label": "Open Webroot",
            "action": "openfilesystem",
            "path": "./", // Path is relative to your webroot
            "disabled": false,
            "image": "/path/to/image.png"
        }
    ],
    "jvm": {
        "heapSize": 512,
        "minHeapSize": 256,
        "args": [
            // Can be a string or an array
            "-XX:+UseG1GC",
            "-XX:-CreateMinidumpOnCrash",
            "--add-opens=java.base/java.net=ALL-UNNAMED"
        ],
        "javaHome": "/path/to/java/home",
        "javaVersion": "openjdk11"
    },
    "web": {
        "host": "127.0.0.1",
        // Used for default bindings
        "hostAlias": "site.com",
        "webroot": "src/cfml",
        "directoryBrowsing": true,
        "accessLogEnable": true,
        "maxRequests": 30,
        "gzipEnable": true,
        "gzipPredicate": "regex( '(.*).css' ) and request-larger-than( 500 )",
        "aliases": {
            "/foo": "../bar",
            "/js": "C:/static/shared/javascript"
        },
        "errorPages": {
            "404": "/path/to/404.html",
            "500": "/path/to/500.html",
            "default": "/path/to/default.html"
        },
        "welcomeFiles": "index.cfm,main.cfm,go.cfm",
        "bindings": {
            "HTTP": {
               "listen" : "8080"
            },
            "SSL": {
                "listen": 443,
                "certFile": "",
                "keyFile": "",
                "keyPass": ""
            },
            "AJP": {
                "listen": 8009
            },
        },
        "rewrites": {
            "enable": true,
            "logEnable": true,
            "config": "/path/to/config.xml",
            "statusPath": "/rewriteStatus",
            "configReloadSeconds": 60
        },
        "basicAuth": {
            "enable": true,
            "users": {
                "userName1": "password1",
                "userName2": "password2"
            }
        },
        "rules": [
            "path-suffix(/box.json) -> set-error(404)",
            "path-prefix(.env) -> set-error(404)",
            "path-prefix(/admin/) -> ip-access-control(192.168.0.* allow)",
            "path(/sitemap.xml) -> rewrite(/sitemap.cfm)",
            "disallowed-methods(trace)"
        ],
        // 3 ways to specify rulesFile:
        "rulesFile": "../secure-rules.json",
        // Or...
        "rulesFile": [
            "../security.json",
            "../rewrites.json",
            "../app-headers.json"
        ],
        // Or...
        "rulesFile": "../rules/*.json",
        "blockCFAdmin": false,
        "blockSensitivePaths": true,
        "blockFlashRemoting": true
    },
    "sites": {
        "site-name-here": {
            // Any valid option from "web" plus "profile"
        },
        "another-site-name-here": {
            // Any valid option from "web" plus "profile"
        }
    },
    "app": {
        "logDir": "",
        "libDirs": "",
        "webConfigDir": "",
        "serverConfigDir": "",
        "webXML": "",
        "WARPath": "",
        "cfengine": "lucee@5.x",
        "restMappings": "/rest/*,/api/*",
        "serverHomeDirectory": "",
        "sessionCookieSecure": true,
        "sessionCookieHTTPOnly": true,
        "webXMLOverride": "path/to/web.xml",
        "webXMLOverrideForce": false
    },
    "runwar": {
        "jarPath": "/path/to/runwar.jar",
        "args": [
            // Can be a string or an array
            "--runwar-option",
            "value",
            "--runwar-option2",
            "value2"
        ],
        "XNIOOptions": {
            "WORKER_NAME": "MyWorker"
        },
        "UndertowOptions": {
            "ALLOW_UNESCAPED_CHARACTERS_IN_URL": true
        }
    },
    "scripts":{
        "onServerInitialInstall":"cfpm install mysql websocket"
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://commandbox.ortusbooks.com/embedded-server/server-json.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
