CorefinityCorefinityDocs
Open the Control PanelControl Panel
Site settings · 3 of 8

Add your own nginx rules to a site, test them and save them.

On this page

Before you start

  • You can open the site in Managed Websites. Anyone who can open a site can change its rules.
  • Each environment has its own rules: choose Production or Staging in the site header first.
  • For a redirect, a password or a PHP setting, use Redirects, Password protection or Software & services instead.

Add a rule

  1. Open the site's rules

    Go to Managed Websites, choose the site, then Web server rules under Site settings. A site with no rules reads Not set.

  2. Start from a snippet, or write your own

    Choose Start from a snippet, find one such as Long-lived caching for static files and choose Insert at cursor; or choose Write rules and type them. The tabs Server, Headers, PHP and HTTP hold the rules for each part of the configuration.

  3. Test the rules

    Choose Test: the rules are checked, then tried with this environment's own web server, and the result reads Passed. A problem is listed under Problems with its line.

  4. Review and save

    Choose Save, and Review and save shows your change. Enter a Note for History if you want one, then choose Save.

The rules apply straight away and the card reads Live. The site is then checked: if a check fails, your previous rules come back on their own and the card reads Rolled back.

To bring the rules from an Apache host, see Convert .htaccess.

To serve a folder or a second app under a path, see Path apps.

Go back to earlier rules

  1. Open History

    Open the section's … menu and choose History, where each save is a Revision. Choose one, then Revert to this and Revert.

A revert saves a new revision with the old content, tested first. The last 100 revisions of an environment are kept.

Limits

  • Each of the 4 tabs holds up to 64 KB, and an environment up to 200 locations. The meters above the editor show both.
  • Some directives are refused, such as listen, server_name, include and ssl_certificate. Problems names the line.

Automate this

Web server rules

Saves the hooks sent in content at the version you read: a hook left out stays as it is, and "" or null clears it.

PUT/api/corestack/sites/{site}/nginx-rules
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/nginx-rules \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "WordPress admin under /wp/",
    "path_apps": [
      {
        "label": "Blog admin",
        "php": {
          "dir_index": [
            "wp-admin/"
          ],
          "entries": [
            "wp-admin/*.php",
            "wp-login.php"
          ],
          "router": [
            "wp-json/"
          ]
        },
        "prefix": "/wp/",
        "preset": "wordpress-admin",
        "root": "htdocs",
        "type": "php-app"
      }
    ],
    "version": 0
  }'
Was this helpful?
Open in ClaudeOpen in ChatGPT