Commit Graph

113 Commits

Author SHA1 Message Date
Valentin Bartenev
376d758dd7 PHP: implemented "targets" option.
This allows to specify multiple subsequent targets inside PHP applications.
For example:

  {
      "listeners": {
          "*:80": {
              "pass": "routes"
          }
      },

      "routes": [
          {
              "match": {
                  "uri": "/info"
              },

              "action": {
                  "pass": "applications/my_app/phpinfo"
              }
          },
          {
              "match": {
                  "uri": "/hello"
              },

              "action": {
                  "pass": "applications/my_app/hello"
              }
          },
          {
              "action": {
                  "pass": "applications/my_app/rest"
              }
          }
      ],

      "applications": {
          "my_app": {
              "type": "php",
              "targets": {
                  "phpinfo": {
                      "script": "phpinfo.php",
                      "root": "/www/data/admin",
                  },

                  "hello": {
                      "script": "hello.php",
                      "root": "/www/data/test",
                  },

                  "rest": {
                      "root": "/www/data/example.com",
                      "index": "index.php"
                  },
              }
          }
      }
  }
2020-05-14 13:15:01 +03:00
Valentin Bartenev
0174c971b5 Configuration: URI encoding in the "pass" option.
This is useful to escape "/" in path fragments.  For example, in order
to reference the application named "foo/bar":

  {
      "pass": "applications/foo%2Fbar"
  }
2020-05-14 13:15:00 +03:00
Igor Sysoev
01e957ef64 Rational number support in upstream server weight. 2020-03-30 19:47:01 +03:00
Valentin Bartenev
68c6b67ffc Configuration: support for rational numbers. 2020-03-30 19:37:58 +03:00
Valentin Bartenev
c63b498f94 Implemented "location" option for "return" action.
This allows to specify redirects:

  {
      "action": {
          "return": 301,
          "location": "https://www.example.com/"
      }
  }
2020-03-21 01:39:00 +03:00
Valentin Bartenev
8d727774e3 Implemented "return" action.
The "return" action can be used to immediately generate a simple HTTP response
with an arbitrary status:

  {
      "action": {
          "return": 404
      }
  }

This is especially useful for denying access to specific resources.
2020-03-27 17:22:52 +03:00
Max Romanov
5296be0b82 Using disk file to store large request body.
This closes #386 on GitHub.
2020-03-12 17:54:29 +03:00
Igor Sysoev
7935ea4543 Round robin upstream added. 2020-03-06 18:28:54 +03:00
Valentin Bartenev
a98de7f705 Added a "fallback" option to be used with the "share" action.
It allows proceeding to another action if a file isn't available.

An example:

    {
        "share": "/data/www/",

        "fallback": {
            "pass": "applications/php"
        }
    }

In the example above, an attempt is made first to serve a request with
a file from the "/data/www/" directory.  If there's no such file, the
request is passed to the "php" application.

Fallback actions may be nested:

    {
        "share": "/data/www/",

        "fallback": {
            "share": "/data/cache/",

            "fallback": {
                "proxy": "http://127.0.0.1:9000"
            }
        }
    }
2020-03-03 20:37:47 +03:00
Valentin Bartenev
a60f856ce2 Improved validation of the "action" object.
Now it enforces the mutual exclusivity of "pass", "proxy", and "share" options.
2020-03-03 20:37:47 +03:00
Axel Duch
1a76371499 Router: introducing routing on listener address. 2019-12-24 13:59:58 +00:00
Axel Duch
8677bf8d41 Router: introducing routing on client address. 2019-12-24 13:58:10 +00:00
Max Romanov
64f649f990 Adding "limits/shm" configuration validation and parsing. 2019-12-24 18:04:09 +03:00
Igor Sysoev
ddde9c23cf Initial proxy support. 2019-11-14 16:39:54 +03:00
Igor Sysoev
09e7357b08 Style fixes. 2019-10-10 19:42:41 +03:00
Valentin Bartenev
75453479f3 Configuration: added check for mandatory options of "action". 2019-10-09 15:26:59 +03:00
Valentin Bartenev
08a8d1510d Basic support for serving static files. 2019-09-19 02:47:09 +03:00
Tiago de Bem Natel de Moura
c554941b4f Initial applications isolation support using Linux namespaces. 2019-09-19 15:25:23 +03:00
Max Romanov
e501c74ddc Introducing websocket support in router and libunit. 2019-08-20 16:31:53 +03:00
Axel Duch
7785c96c1a Added routing based on request scheme.
Scheme matches exact string “http” or “https”.
2019-07-24 13:47:35 +03:00
Igor Sysoev
0ba7cfce75 Added routing based on header fields. 2019-05-30 15:33:51 +03:00
Valentin Bartenev
5e1cf14565 Controller: rejecting double wildcards. 2019-04-12 17:44:55 +03:00
Igor Sysoev
8339b15158 Added support for wildcards in the middle of match patterns. 2019-04-10 13:47:34 +03:00
Max Romanov
687f83fbd0 Style fixing.
This closes #233 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).
2019-03-22 15:32:35 +03:00
Max Romanov
5bfdebb9e4 Introducing Java Servlet Container beta. 2019-02-28 18:02:42 +03:00
Valentin Bartenev
a881c31abd Controller: added "routes" configuration. 2019-02-27 16:50:37 +03:00
Valentin Bartenev
c24c0deb19 Controller: added "pass" configuration option. 2019-02-27 16:44:52 +03:00
Valentin Bartenev
029c1a9f50 Renamed "go" application type to "external".
There's nothing specific to Go language.  This type of application object can
be used to run any external application that utilizes libunit API.
2018-10-09 17:53:31 +03:00
Valentin Bartenev
8d844bc2aa Controller: certificates storage interface. 2018-09-20 15:27:08 +03:00
Valentin Bartenev
1abdcfb2d8 Controller: added "settings" configuration object.
It has the following structure and default values:

  {
      "http": {
          "header_read_timeout": 30,
          "body_read_timeout": 30,
          "send_timeout": 30,
          "idle_timeout": 180,
          "max_body_size": 8388608
      }
  }
2018-07-09 20:34:51 +03:00
Valentin Bartenev
0366bfad6d Fixed error message about "spare" value. 2018-07-02 18:19:00 +03:00
Valentin Bartenev
1a52d876f7 Introduced nxt_length() macro. 2018-06-25 16:51:47 +03:00
Sergey Kandaurov
14bc401394 Using own popcount where the compiler builtin is not available. 2018-06-20 19:34:06 +03:00
Valentin Bartenev
8f278a5fed PHP: added setting of individual configuration options. 2018-06-07 16:17:32 +03:00
Valentin Bartenev
388390888b PHP: added setting of php.ini configuration file path. 2018-06-07 16:17:31 +03:00
Valentin Bartenev
ceeb301881 Go: specifying command line arguments to the executable.
This closes #110 issue on GitHub.
2018-06-06 16:53:35 +03:00
Valentin Bartenev
d7e6e2bd8c Configuration of environment variables for application processes. 2018-05-28 20:55:23 +03:00
Valentin Bartenev
204c394721 Initial access log support. 2018-04-11 18:23:33 +03:00
Alexander Borisov
37051b6c15 Added Ruby support. 2018-03-21 16:50:07 +03:00
Valentin Bartenev
fc496c19ac Changed the default number of spare processes to 0. 2018-02-09 19:06:53 +03:00
Andrey Zelenkov
949ba262cc Style fixes. 2018-02-07 15:34:42 +03:00
Andrey Zelenkov
b4e467e669 Fixed configuration checks for "max" property. 2018-02-06 20:31:48 +03:00
Alexander Borisov
960962ddce Added Perl support. 2018-01-31 15:47:00 +03:00
Max Romanov
9cd4fdbdb7 Introducing extended app process management.
- Pre-fork 'processes.spare' application processes;
- fork more processes to keep 'processes.spare' idle processes;
- fork on-demand up to 'processes.max' count;
- scale down idle application processes above 'processes.spare' after
  'processes.idle_timeout';
- number of concurrently started application processes also limited by
  'processes.spare' (or 1, if spare is 0).
2018-01-29 16:17:36 +03:00
Valentin Bartenev
01ec9a5dba Ability to validate configuration options with multiple types. 2018-01-18 15:52:44 +03:00
Max Romanov
2db8e586e5 Reduced duplication of validated app config options.
Common options moved to separate array.  Application-specific arrays refers
to common options.
2018-01-18 09:08:25 +03:00
Max Romanov
c2918a0014 Introducing pretty NXT_CONF_VLDT_END macro. 2018-01-18 09:08:16 +03:00
Igor Sysoev
dbd7540a04 Removed duplicate declaration. 2017-12-28 20:50:49 +03:00
Max Romanov
5196cf4d50 Rescheduling of pending request after configured timeout.
New optional configuration parameter introduced: limits.reschedule_timeout.
Default value 1 second.  In the case when request is written to the port
socket 'in advance', it is called 'pending'.

On every completed request, the head of pending request is checked against
reschedule timeout.  If this request waiting for execution longer than
timeout, it is cancelled, new port selected for this request.
2017-12-27 17:48:04 +03:00
Max Romanov
3781950bad Introducing python virtualenv configuration.
New parameter 'home' for python application allows to configure
application-specific virtualenv path.

This closes #15 issue on GitHub.
2017-11-29 18:48:55 +03:00