v. 1.22.0

Ruby on Rails§

To run apps based on the Ruby on Rails framework using Unit:

  1. Install Unit with a Ruby language module.

  2. Install Ruby on Rails and create or deploy your app. Here, we use Ruby on Rails’s basic template:

    $ cd /path/to/
    $ rails new app

    This creates the app’s directory tree at /path/to/app/; its public/ subdirectory contains the static files, while the entry point is /path/to/app/

  3. Run the following command for each directory containing app code or data so Unit can access it:

    # chown -R unit:unit /path/to/app/


    The unit:unit user-group pair is available only with official packages, Docker images, and some third-party repos. Otherwise, account names may differ; run the ps aux | grep unitd command to be sure.

    For further details, including permissions, see the security checklist.

  4. Next, prepare the Ruby on Rails configuration for Unit (use real values for share, script and working_directory):

        "listeners": {
            "*:80": {
                "pass": "routes/rails"
        "routes": {
            "rails": [
                    "action": {
                        "share": "/path/to/app/public/",
                        "fallback": {
                            "pass": "applications/rails"
        "applications": {
            "rails": {
                "type": "ruby",
                "script": "",
                "working_directory": "/path/to/app/"
  5. Upload the updated configuration. Assuming the JSON above was added to config.json:

    # curl -X PUT --data-binary @config.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config/


    The control socket path may vary; run unitd --help or see Startup and Shutdown for details.

    After a successful update, your app should be available on the listener’s IP address and port:

    Ruby on Rails Basic Template App on Unit