NGINX Unit

Joomla§

To install and run the Joomla content management system using Unit:

  1. Install Unit with a PHP language module.

  2. Next, install Joomla and its prerequisites if you haven’t already done so.

  3. Set permissions for the application directory to ensure Unit can access it, for example:

    # chown -R joomla_user:joomla_group /path/to/joomla/  # user:group for app config in Unit
    
  4. Finally, prepare and upload the app configuration to Unit (note the use of script in joomla_index):

    {
        "listeners": {
            "*:80": {
                "pass": "routes/joomla"
            }
        },
    
        "routes": {
            "joomla": [
                {
                    "match": {
                        "uri": [
                            "*.php",
                            "*.php/*",
                            "/administrator/"
                        ]
                    },
    
                    "action": {
                        "pass": "applications/joomla_direct"
                    }
                },
                {
                    "action": {
                        "share": "/path/to/joomla/",
                        "fallback": {
                            "pass": "applications/joomla_index"
                        }
                    }
                }
            ]
        },
    
        "applications": {
            "joomla_direct": {
                "type": "php",
                "user": "joomla_user",
                "root": "/path/to/joomla/"
            },
    
            "joomla_index": {
                "type": "php",
                "user": "joomla_user",
                "root": "/path/to/joomla/",
                "script": "index.php"
            }
        }
    }
    

    The first route step handles the admin section and all URLs that specify a PHP script; the joomla_direct app doesn’t set the script option to be used by default, so Unit looks for the respective .php file. The next step serves static file types via a share; the fallback here enables rewrite mechanics for search-friendly URLs, routing all requests via the index.php at the base of Joomla’s file structure.

    Assuming the config above is saved as joomla.json:

    # curl -X PUT --data-binary @joomla.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config
    
  5. After a successful update, you can proceed to set up your Joomla installation in the browser:

    Joomla on Unit - Setup Screen