Adding Bedrock to Local version 5

Hi there!
I’m trying to use Bedrock on Local version 5.0.7+1117 on Windows and I am having some issues.
I was following this guide and the problem I have is that replacing the "{{root}}"; to /app/bedrock/web; in conf/nginx/site.conf.hbs doesn’t change the root directory so I get these errors:

Any help would be really appreciated.

Thank you,
Ivan

I have the same problem… After watcing this video, I was going to try “Local by Flyweel”. But now its not really an option for me since I do all my devlopment in Bedrock / Sage-theme

I am having the exact same issue, but on a MAC. If anyone can help, that would be appreciated.

It’s great to see the interest around using Bedrock with Local!

Local 5 and newer utilizes a native stack, so paths such as /app won’t work anymore. You will need to provide the entire path.

The root in your nginx.conf.hbs should look something like the following:

    root   "/Users/claygriffiths/Local Sites/bedrock-test/app/bedrock/web";

Note, the path that shows for the site inside Local is ~/Local Sites/bedrock-test. Nginx doesn’t work with ~/, so you’ll need to swap it out with one of the following:

  • macOS: /Users/YOUR_USERNAME
  • Windows: C:\Users\YOUR_USERNAME
  • Linux: /home/YOUR_USERNAME

If you are using Bedrock or change where wp-config.php is, you will see errors on the Database tab in Local like in screenshot that @teddy posted above. Don’t fret! As long as you configure the .env file in Bedrock to match up with the defaults shown in the Database tab, the DB connection should be good to go!

3 Likes

Hello there, i’m having the same issue with Local v5.0.5 (Mac version).

After creating a new site following that bedrock & flywheel video, i updated the site.conf.hbs (since root is not defined on nginx.conf.hbs) just the way you said @clay.

Then i restart Local and start the bedrock site, but nothing changes, Database tab still shows “Unable to find DB_NAME in app/public/wp-config.php” even after updating the root to:

root "/Users/alejandro/Local Sites/bedrock/app/bedrock/web";

Also i was not able to update the path that shows for the site inside Local, still shows ~/Local Sites/bedrock, how i’m i supossed to do that?

Am i missing something or is this method not possible with this Local version?


Update: even if the database tab shows those “Unable to find…” the site is actually working (site and admin), so i guess it’s a Local warning that uses the default path just for that check?


Thanks!

1 Like

Awesome, glad you got it!

The DB errors on the Database tab can be ignored as long as the .env file is configured correctly.

I tried doing the same thing but I keep getting a 502 error when I try to access the website (using the v5 Local beta). I modified the nginx.conf.hbs file to put the root location in at the top of the file. Is it supposed to be here? Should I just let this go and install the older v3 of the tool and try to use that?

Hey @coolwebs!

I’ m a little late but it worth nothing.
I had a similar problem, check if the root path is between double quotes like:

root “/Users//Local Sites//app/bedrock/web/”;

Hi! I hope it help you)

Open file site.conf.hbs
Change string root {{root}} on root "/Users/usernamecomputer/Local Sites/bedrock/app/bedrock/web";

Open file .env
DB_NAME=‘local’
DB_USER=‘root’
DB_PASSWORD=‘root’

WP_ENV=‘development’
WP_HOME=‘https://bedrock.local

Restart Local by flywheel and done! Enjoy!))

ps. Open site next path: https://yourdomain.local/wp/wp-admin/

1 Like

Hi Clay,

I wonder if you see my issue here, I’ve updated the site.conf.hbs file to this:

root ‘C:\Users\jordan.charters\Local Sites\comfydevmulti\app\bedrock\web’;

I see this error however:

One thing I see is the change from \ to / after \web

Once you’ve modified site.conf.hbs, there are a few other things you can do for convenience.

In the Local app, selecting the Admin button will give you a 404 “File not found” message. To correct this, you can do the following:

  • Start up wp-admin by going to https://yourdomain.local/wp/wp-admin
  • Download the Redirection plugin.
  • Create a redirection entry of regex type with the following values:
    • Source URL: ^/wp-admin/(.*)$
    • Target URL: /wp/wp-admin/$1
    • Group: Redirections (default)
  • Restart the site. Now when you press the Admin button you should get your site’s WordPress admin page.

Rather than installing an entire plugin just to fix a single link, you can add the equivalent rule directly in site.conf.hbs (I place this beneath the “WordPress Rules” block):

rewrite ^/(wp-admin.*)$ $scheme://$http_host/wp/$1 permanent;

1 Like

You can ignore the slash reversal in the path you’re seeing. However, the error indicates Wordpress can’t find the wp-blog-header.php and I can reproduce your error by renaming that file, so ensure it is available at the path shown.

Also, you can apply a relative path modifier for the root path declaration, e.g.
root "{{root}}\web";

Hi Guys,

Im getting the same issue.
This is what my code in site.conf.hbs looks like, yet im still getting the 502 error?

upstream php {

{{#each fastcgi_servers}}

server {{this}};

{{/each}}

}

server {

root  "C:/Users/Marinko/Local Sites/kaptured/app/bedrock/web/";

Im operating on windows

Thanks for the replies @wiibopp and @genyus, the reason was I had not run composer install yet. Solved when running this :slight_smile:

1 Like

Hi everyone,

After installing Bedrock in my Local environement and set the settings of both files .env and site.conf.hbs I am redirecting to my localhost Apache server ( /var/www/html ) instead of the Local wp server.
I tried many times to reinstall but I still have this weird behavior and I’m confusing if someone have a hint it would be nice !

My OS system : Linux Mint 19.3 Cinnamon

.env file :

DB_NAME=local
DB_USER=root
DB_PASSWORD=root

WP_ENV='development'
WP_HOME='https://bedrock.local'
WP_SITEURL="${WP_HOME}/wp"
WP_DEBUG_LOG=/path/to/debug.log

site.conf.hbs file :

server {
	listen {{port}};
    root   "/home/wissem/Local Sites/test/app/bedrock/web";

Thanks,

Sounds like you need to enable localhost Router Mode under Preferences > Advanced > Router Mode. Local can’t use the default site domain mode when another application (Apache, in your case) is using port 80 or 443.

Hi @genyus,

Thanks for the help but the localhost Router Mode was already enabled in my preferences.
Also if I make a normal install without using bedrock, it’s working correctly with the default settings, so I think that is when I install bedrock and set the settings that something is messing up…
I take screenshot of my panel :

If anyone has a hint I’m still searching why I can’t make this working ^^"

OK, I think I see the problem. Your site is hosted at localhost:10000, but you’ve set WP_HOME as https://bedrock.local, which is why Apache is responding (as it has ownership of ports 80 and 443). Change it to http://localhost:10000 (remember, HTTPS isn’t supported in local router mode) and you should be set.