Environments


    The Devilbox The Devilbox is a modern and highly customisable dockerized PHP stack supporting full LAMP and MEAN and running on all major platforms. The main goal is to easily switch and combine any version required for local development. It supports an unlimited number of projects for which vhosts, SSL certificates and DNS records are created automatically. Reverse proxies per project are supported to ensure listening server such as NodeJS can also be reached. Email catch-all and popular development tools will be at your service as well. Configuration is not necessary, as everything is already pre-setup.

    Furthermore, the Devilbox provides an identical and reproducible development environment for different host operating systems.

    This example will use to install Phalcon from within the Devilbox PHP container. After completing the steps listed below, you will have a working Phalcon setup ready to be served via http and https.

    The following configuration will be used:

    Your environment will be ready in six simple steps:

    • Create a new VirtualHost directory
    • Install Phalcon
    • Symlink webroot directory
    • Setup DNS record
    • Visit in your browser
    • (Nginx) Create custom vhost config file

    All the work will be performed inside the PHP container since it offers all the necessary tools. Navigate to the Devilbox git directory and execute ./shell.sh (or shell.bat on Windows) to enter the running PHP container.

    Create new vhost directory

    The vhost directory defines the name under which your project will be available. (<vhost dir>.TLD_SUFFIX will be the final URL ).

    1. in /shared/httpd $ mkdir my-phalcon

    Navigate into your newly created vhost directory and install Phalcon with phalcon cli.

    The directory structure looks like this after the installation:

    1. .
    2. └── phalconphp
    3. 1 directory, 0 files

    Some frameworks however, store files and content in nested directories of unknown levels. It is therefore impossible to set this as a pre-set for the environment. You will therefore have to manually set a symlink back to the expected path that your framework requires.

    The directory structure looks like this after the installation:

    1. in /shared/httpd/my-phalcon $ tree -L 1
    2. ├── phalconphp
    3. └── htdocs -> phalconphp/public
    4. 2 directories, 0 files

    As you can see in the above listing, the htdocs folder that is required by the web server is now pointing to the entry point of your framework.

    When using Docker Toolbox, you need to explicitly allow the usage of symlinks.

    If you have Auto DNS configured already, you can skip this section, because DNS entries will be available automatically by the bundled DNS server.

    If you do not have Auto DNS configured, you will need to add the following line to your host operating system file (or C:\Windows\System32\drivers\etc on Windows):

    Open your browser

    Open your browser and navigate to or https://my-phalcon.loc

    By default routes will not work if using Nginx. To fix this, you will need to create a custom vhost configuration.

    In your project folder, you will need to create a folder called .devilbox unless you changed HTTPD_TEMPLATE_DIR in your .env

    Carefully edit the nginx.yml file and change:

    try_files $uri $uri/ /index.php$is_args$args;

    to

    try_files $uri $uri/ /index.php?_url=$uri&$args;

    and

    location ~ .php?$ {

    to

    location ~ [^/].php(/|$) {

    Save the file as nginx.yml and ensure not to use any tabs in the file or devilbox will not use the custom configuration. You can use yamllint nginx.yml whilst inside the Devilbox shell to check the file before restarting devilbox.