Roots Discourse

After first provisioning on DigitalO, i get 500 error with: 'rewrite or internal redirection cycle'

Hello folks,

My name is Sebastiaan and i’ve been developing a website for a client locally on my pc.
My first time using the roots projects and I love the Trellis + Bedrock + Sage combination. Learned a lot from the roots projects!
I’m still a rooky, so i wanted to first experiment with a naked trellis+bedrock install online on a DigitalOcean droplet.

What i did:
I followed this tutorial: https://www.youtube.com/watch?v=Ls30HGKru8A. After the “ansible-playbook server.yml -e env=production” command, i visit the server and got a 500 Internal server error.

The /srv/www/example.com/logs/error.log is as follows:

2018/05/22 12:20:59 [error] 15617#15617: *1 rewrite or internal redirection cycle while internally redirecting to “/index.php”, client: 62.251.35.104, server: sebastiaan-dekker.nl, request: “GET / HTTP/1.1”, host: “sebastiaan-dekker.nl”
2018/05/22 12:21:02 [error] 15617#15617: *2 rewrite or internal redirection cycle while internally redirecting to “/index.php”, client: 62.251.35.104, server: sebastiaan-dekker.nl, request: “GET /favicon.ico HTTP/1.1”, host: “sebastiaan-dekker.nl”, referrer: “http://sebastiaan-dekker.nl/

DNS & Nameservers
I got my domain registered on mijndomein.nl. There i changed the default DNS to point to the DigitalO droplet ip-adres (not sure if this is needed if you also change the nameservers, in order to use the DigitalO DNS).
At mijndomein.nl i also changed the nameservers to match those of the DigitalO nameservers (this was needed to activate the DigitalO DNS:

In DigitalOcean i added a domain to the droplet, which resulted in:

I posted the DNS changes i made, cause i’m not sure what the error implies. Could someone help me out please?

Greetz Sebastiaan

You don’t mention whether you deployed. You’ll definitely get a 500 error if you skip that step.

1 Like

Thank you for the fast reply @MWDelaney.

I’m not sure if anybody else has the same errors, but maybe it helps someone out if i post some

1 hour after your reply I deployed the naked Trellis+Bedrock successful on the DigitalOcean droplet.
Rookie lesson 1: Always deploy after provisioning

After that i copied the group_vars from the naked Trellis+Bedrock to the project i’m working on:

  1. Double checked group_vars production yml object settings.
  2. Provisioned the server (0 errors).
  3. Deployed (0 errors).
  4. Checked website and browser said: https://sebastiaan-dekker.nl/wp/wp-admin/install.php (This page isn’t working).
    “Bumps head onto table”.
  5. Checked the error.log through ssh login into server.

Error log says:

2018/05/23 07:01:38 [error] 6205#6205: *6 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(/srv/www/newdealseals.com/releases/20180523065938/web/app/mu-plugins/newde
alseals/seals-post-types/rubber-seal.php): failed to open stream: No such file or directory in /srv/www/newdealseals.com/releases/20180523065938/web/app/mu-plugins/newdealseals.php on line 7

PHP message: PHP Fatal error: require_once(): Failed opening required ‘/srv/www/newdealseals.com/releases/20180523065938/web/app/mu-plugins/newdealseals/seals-post-types/rubber-seal.php’ (include_path=’.:/usr/share/php’) in /srv/www/newdealseals.com/releases/20180523065938/web/app/mu-plugins/newdealseals.php on line 7" while reading response header from upstream, client: 213.125.96.154, server: sebastiaan-dekker.nl, request: “GET /wp/wp-admin/install.php HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm-wordpress.sock:”, host: “sebastiaan-dekker.nl”

  1. Found out after 3 hours that your custom Sage theme needs some composer and npm installations as well. Solution with Trellis: Uncomment the right lines in deploy-hooks/build-before.yml
    Rookie lesson 2: Sage needs composer and npm installations on itself. Trellis has the godmode solution in deploy-hooks/build-before.yml.

  2. Rebuild droplet -> Provision server -> Deploy with Sage hooks activated.

  3. Still got the same error.

I bought the ‘Theme development with Sage’ book. It helped me out big time and i’m going to donate to the roots fund, cause i learned lots and lots. The whole workflow with the roots projects feels so fast and flexible compared to developing with the ‘Genesis Framework’.
In chapter Starting a project -> Planning out the theme, the authors advice to ‘Keep site functionality outside of the theme’. I followed the example mu-plugin setup from the Roots website like this:

require_once(dirname(__FILE__) . '/newdealseals/seals-post-types/rubber-seal.php');

It seems like the added maps to the mu-plugin Bedrock Wordpress project structure don’t get deployed. This result was my error from the beginning.

Rookie lesson 3: some added maps to the Bedrock structure don’t get deployed.

I’m going to try to find out how to add these maps to the deploy.

Sounds like you need to update the .gitignore file in the site directory to allow for your new mu-plugin files to be committed to the repository

In the .gitignore you’ll see this line:

web/app/mu-plugins/*/

After that, add:

!web/app/mu-plugins/newdealseals/
2 Likes

wow, I read the Sage book and fell in the same trap 10 minutes ago. Can roots devs consider adding a note to the book regarding editing .gitignore?