NGINX Unit

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_direct": {
                "type": "php",
                "user": "phpbb_user",
                "root": "/path/to/phpbb/"
            },
    
    
            "phpbb_index": {
                "type": "php",
                "user": "phpbb_user",
                "root": "/path/to/phpbb/",
                "script": "app.php"
            }
        }
    }
    

    Note

    The difference between the apps is their usage of the script setting. Here, phpbb_index specifies the script that Unit runs for any URIs the app receives. In contrast, the phpbb_direct app serves URIs that reference a specific .php file by running it; if there’s no file specified, it defaults to index.php.

  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