Craft CMS 3 in a container using Nanobox
Download and Install Nanobox
Create a New Project Directory and Run the Bootstrap
# create a new project directory and cd in mkdir nanobox-craft3 && cd $_ # run the bootstrap bash <(curl -sL https://git.io/fpPHA)
You're ready to develop!
This will do the following:
- Create and configure a new instance of Nanobox environment
- Install and configure PHP 7.1 with all necessary extensions
- Install and configure PHP-FPM
- Install and configure Nginx server
- Install the MySql CLI to allow the Craft CP to backup the DB
- Install Composer to manage all PHP dependencies
- Install and configure MySql Database server
- Create and configure a new Craft CMS 3 project
You'll find the IP where you can see the running app in the output.
Add a DNS Alias
Nanobox lets you easily add a local URL to access your Craft app in the browser. To add a DNS alias, run the following from the root of your project (outside the Nanobox console).
nanobox dns add local nanobox-craft3.test
nanobox run php-server, you'd be able to access the running app at
Developing your Project
Once the project is provisioned, simply open the project directory
nanobox-craft3 in your code editor and start developing.
You can drop into a console in the environment at any time by running:
Your local codebase is mounted into the dev container. Any changes to the code are reflected in your dev app. You can add and load dependencies or any other dev tasks. Or you can simply start Craft.
- Create a new app in your Nanobox dashboard
- Add your new app as a remote on your project:
nanobox remote add app-name
- Deploy to your live app: