NGINX Unit
v. 1.18.0

phpBB§

To install the phpBB bulletin board using Unit:

  1. Install Unit with a PHP language module.

  2. Check and configure phpBB’s prerequisites.

  3. Download and extract phpBB files:

    $ cd /path/to/phpbb/
    $ curl -O https://download.phpbb.com/pub/release/3.3/3.3.0/phpBB-3.3.0.zip
    $ unzip phpBB-3.3.0.zip
    $ mv phpBB3/* ./ && rm -rf phpBB3/
    # chown -R phpbb_user:phpbb_group .
    

    In this example, the files will be stored in /path/to/phpbb/.

  4. Next, prepare and upload the app configuration to Unit:

    {
        "listeners": {
            "*:80": {
                "pass": "routes/phpbb"
            }
    
        },
    
        "routes": {
            "phpbb": [
                {
                    "match": {
                        "uri": [
                            "/cache/*",
                            "/common.php*",
                            "/config.php*",
                            "/config/*",
                            "/db/migration/data/*",
                            "/files/*",
                            "/images/avatars/upload/*",
                            "/includes/*",
                            "/store/*"
                        ]
                    },
    
                    "action": {
                        "return": 403
                    }
                },
                {
                    "match": {
                        "uri": [
                            "*.php",
                            "*.php/*"
                        ]
                    },
    
                    "action": {
                        "pass": "applications/phpbb/direct"
                    }
                },
                {
                    "action": {
                        "share": "/path/to/phpbb/",
                        "fallback": {
                            "pass": "applications/phpbb/index"
                        }
                    }
                }
            ]
        },
    
        "applications": {
            "phpbb": {
                "type": "php",
                "user": "phpbb_user",
                "targets": {
                    "direct": {
                        "root": "/path/to/phpbb/"
                    },
    
                    "index": {
                        "root": "/path/to/phpbb/",
                        "script": "app.php"
                    }
                }
            }
        }
    }
    

    Note

    The difference between the pass targets is their usage of the script setting:

    • The direct target runs the .php script from the URI or defaults to index.php if the URI omits it.
    • The index target specifies the script that Unit runs for any URIs the target receives.
  5. Assuming the config above is saved as phpbb.json:

    # curl -X PUT --data-binary @phpbb.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config
    
  6. Browse to /install/app.php to configure the settings from Step 2 and complete your installation. Having done that, delete the install/ subdirectory to mitigate security risks:

    $ rm -rf /path/to/phpbb/install/
    

    Finally, your board is ready!

    phpBB on Unit