Missing step installing bedrock?

I find the instructions for using bedrock slightly confusing, sorry if I’m being thick, but I feel like there is one or more steps missing

  1. Clone bedrock to your machine
  2. Execute composer install
  3. Copy .env.example to .env and add your case specific settings (db name, dblogin etc)
  4. Add a theme to themes folder
  5. Configure your local machine (hosts, vhosts)
  6. Log in at wp/wp-admin

What I don’t understand is how the .env variables will be used. When I access my local installation I just get “could not connect”/“timeout” error. I can however load the readme.html at my.local.site/readme.html that lives in ‘/web/wp’ alongside index.php which proves that my virtualhost is working correctly and pointing to the correct folder…

What am I missing?

1 Like

Replace constants with your own at .env file:
(and don’t forget /wp at end of WP_SITEURL)


1 Like

Hi Aitor and thanks for replying. I did configure the .env file for my localhost. I have successfully installed the entire stack with trellis several times previously, but using only bedrock to quickly install a devel site… – I just can’t get it to work.

I abondened this and used a pure wp-cli setup instead.

The idea for me is to automate and save time and now I’ve spent at least four hours trying to create a “bedrock” setup without success. So I gave it up.

My impression after googling like crazy and reading the bedrock threads here, is that almost no one uses bedrock on its own (without trellis and vagrant – or some other ansible script). My impression is that there is something missing in the bedrock installation instructions.

If someone takes an interest in this issue I urge them to try a clean install where they follow the instructions given for bedrock without using any “implicit” knowledge.

For what it’s worth, I just did a clean bedrock install and followed the instructions to the letter. WordPress was installed correctly.

1 Like

Hello @DaveNaylor. That’s great news. Would you please describe the exact steps you took/did?


$git clone https://github.com/roots/bedrock.git bedrock.local/
$cd bedrock.local/
$wp dotenv init --template=.env.example --interactive

Open browser, navigate to http://bedrock.local, complete install screen, visit new local site at http://bedrock.local


There are a lot of people out there that use Bedrock without Trellis or Vagrant.

There is no relation between Bedrock and Vagrant or Trellis.

They’re used by phpdotenv after you’ve followed step 2 (composer install). If you read the source code you can see how they’re used:

Installing Bedrock really is as simple as following the steps listed:

Hey, I just finished setting Bedrock up with Scotch Box. I’m looking to possibly run bedrock on my shared host (SiteGround), and I wanted to try setting up on something other than Trellis.

Here’s a fairly in depth step by step.

1) Clone Scotch Box to a project folder

git clone https://github.com/scotch-io/scotch-box.git myproject

2) CD to the project directory, then clone Bedrock

cd myproject
git clone https://github.com/roots/bedrock.git

3) Modify the Vagrantfile

Scotch Box uses ‘public’ for the site root, my host uses ‘public_html’, so I wanted that to be straightened out from the start. So I added this to the vagrant file -

    #change public to public_html
    config.vm.provision "shell", inline: <<-SHELL
        mv /var/www/public /var/www/public_html
        sudo sed -i s,/var/www/public,/var/www/public_html,g /etc/apache2/sites-available/000-default.conf
        sudo sed -i s,/var/www/public,/var/www/public_html,g /etc/apache2/sites-available/scotchbox.local.conf
        sudo service apache2 restart

Also, Scotch doesn’t ship with Xdebug, which I wanted, so I added -

    # install Xdebug
    config.vm.provision "shell", inline: <<-SHELL
        sudo apt-get install php5-xdebug
        sudo service apache2 restart

and it comes with Composer installed, but not added to the path, so I wanted that as well.

    # add composer to PATH
    config.vm.provision "shell", inline: <<-SHELL
        export PATH="~/.composer/vendor/bin:$PATH" 

All of those solutions I found here.

Finally, on my first attempt I ran into a load of notices and warnings in WP-Admin, I searched and found this thread, with this solution. So, from the Trellis Vagrantfile, I added:

    # Fix for slow external network connections
    config.vm.provider :virtualbox do |vb|
        vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
        vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']

Which took care of the errors and made the WP backend on Scotch Box much quicker. It really was quite slow prior to adding this.

Here’s my full, modified Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

    config.vm.box = "scotch/box"
    config.vm.network "private_network", ip: ""
    config.vm.hostname = "scotchbox"
    config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
    #install Xdebug
    config.vm.provision "shell", inline: <<-SHELL
        sudo apt-get install php5-xdebug
        sudo service apache2 restart

    #change public to public_html
    config.vm.provision "shell", inline: <<-SHELL
        mv /var/www/public /var/www/public_html
        sudo sed -i s,/var/www/public,/var/www/public_html,g /etc/apache2/sites-available/000-default.conf
        sudo sed -i s,/var/www/public,/var/www/public_html,g /etc/apache2/sites-available/scotchbox.local.conf
        sudo service apache2 restart

    #add composer to PATH
    config.vm.provision "shell", inline: <<-SHELL
        export PATH="~/.composer/vendor/bin:$PATH" 

    # Fix for slow external network connections
    config.vm.provider :virtualbox do |vb|
        vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
        vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']


4) Set up the correct directory structure

Next I had to move stuff around in Bedrock where I wanted. Bedrock uses ‘web’ as its site root, so everything in web needed to move to public_html

Scotch comes with a handy index file with various helpful info, MySQL user and password, SSH info, etc. I wanted to keep that, so this command just renames it so it can live peacefully with the WP index.php I’m about to move in.

mv public_html/index.php public_html/info.php

This command moves the contents of /web into /public_html - * is a wildcard, it means grab everything. It won’t grab dot files though, so if you want them you also have to pass bedrock/.* in.

mv bedrock/web/* public_html 

This command deletes the (now empty) web directory. (note, I use trash, hence no rm -rf)

trash bedrock/web

Also, I removed the Scotch git stuff -

trash .git .gitignore

Next I needed to move the contents of the Bedrock directory up one level. Passing . in as the last argument just means to move the targets up one directory. Also, the only dot file I wanted was the .env.example, so I didn’t pass a wildcard there. So, move bedrock with a wildcard for all the files, and move the .env, all up one directory.

mv bedrock/* bedrock/.env.example .

Rename .env.example to .env (I kept a copy for reference)

cp .env.example .env

And, trash the Bedrock directory.

trash Bedrock

5. Update composer.json and application.php

Now that my directories were updated, I needed to let Bedrock know that I wanted to use /public_html as my web root, not /web - again, this whole experiment is in preparation for using this on my shared SiteGround hosting.

2 files needed updating, composer.json and config/application.php

In both files, every instance of web needed to be changed to public_html

I’m generally much quicker in my IDE, but I’ve also been trying to get more comfortable with Vim, because it’s easier to do quick stuff with when you’re already in the command line, and it’s kind of cool, and a good tool to know.

So, I believe there’s four occurrences that need to be changed in composer.json, at the bottom of the file, and one at the top of application.php - be careful if doing find/replace that you don’t mistakenly overwrite the $webroot_dir variables in application.php In Vim I used :%s/web/public_html/gc to confirm each change.

6. Setup the .env file

Finally, I just needed to fill out the .env file with the correct info. Here’s my .env for Scotch Box - (be sure to generate your own salts!)



AUTH_KEY='salts are really long'
SECURE_AUTH_KEY='so I am not pasting them here'
LOGGED_IN_KEY='because they look so obnoxious'
NONCE_KEY='but go generate your own'
AUTH_SALT='at this URL'
LOGGED_IN_SALT='And paste them here like this'
NONCE_SALT='between single quotes'

7. Composer install

Next, I ran composer install and everything was cool but I got a warning or something telling me to run composer update so I did that as well.

8. Edit hosts file
Oh, last thing - - I had to add to my hosts file, to point at my URL, scotch.dev -
sudo vim /private/etc/hosts/

add: scotch.dev

And flush the DNS cache -
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

8. Vagrant up

That’s everything, next I ran vagrant up, the box booted up, I went to scotch.dev in my browser, ran through the installer, and everything worked, and was awesome.

All told, it took me 2 attempts, and about 2, maybe 2 and a half hours to work my way through it. It was a good learning experience I’d guess I could do it again in about ten minutes now that I’ve done it once correctly.

Next time I’ll try to get it up and running on a subdomain, on my shared host, then I’ll start looking into deployment options.

Anyway, hope that helps a bit.


Hi Dave and thanks for taking the time to reply. It seems that “wp dotenv init --template=.env.example --interactive” is the missing step perhaps? I will try it out as soon as I get the chance…

@smutek and @ben Thanks a bunch for your replies, I will check them out in detail and get back…

There’s no missing step. The use of wp dotenv is just an easy way of inserting your variables into the .env file. You could just rename .env.example to .env and manually insert them in your editor. That step is documented in the Bedrock docs:

Copy .env.example to .env and update environment variables


This helped tremendously. Scotchbox and Bedrock are a nice pair. (I haven’t tried Trellis and Bedrock yet, but I plan to give it a solid effort soon.) Thank you.

1 Like

@smutek Thanks so much for taking the time to share this!I have a working ScotchBox/Bedrock install as by your instructions above and was wondering if you have succeeded in deploying this set up with Capistrano to a SiteGround shared account (as in: I have not yet).

Hey @TiborP - I have not, but I haven’t tried either. Things got busy and I kind of forgot about this, but I’ll give it a go this week and post back!

That would be great. I have tried, but ran in to two issues: the composer command that ran, but did not seem to do anything, and secondly I have to figure out the right deploy path; I’m testing this on a subdomain, so the project’s root folder on SG is a sub directory in public_html (while writing this, I wonder if that would work anyhow…??)

Looking forward to your thoughts & experience; it would be awesome to get this working, since I have clients that use SG as well. Getting Trellis to work on a DO droplet was easier BTW :slight_smile:

I have made quite some progression (and learned a whole lot on the way).

I have got Capistrano deploys working; WP and the MU plugins that are defined in the default composer.json are all installed in the right directory. Only thing that’s not working on the remote server, is installing the extra plugins that I’ve added to my composer.json. They do get installed on my local install though…

Any tips or suggestions?

Update: turned out my composer.lock file was not up to date with latest changes in composer.json
After fixing that all went as expected.

I guess I’m up & running :smiley:

1 Like

The salts might be the problem here…

The syntax is a bit confusing, it should be a matter of pasting them in properly, keeping in mind that the generated salts have parentheses AND single quote marks around them


The .env file has just


Please correct me if I’m wrong…

UPDATE: That worked! I got a 500 server error the first time I tried it. No more:)