Http 500 error... nginx questions


#1

Hi guys,

Went to login to a local dev site and after running up Vagrant I found that the site has a HTTP 500 error. Am working on updating plugins (first in staging and then on production - in Digital Ocean).

Guess I need to find the error log for Nginx. But can’t quite work out where it is or even where nginx is installed.

Am running Max OS 10.13.1 with Sage 8 I think.

Can anyone point me in the right direction? The docs for Nginx and various articles I’m finding on the web aren’t matching my config.


#2

Is this a Trellis based project?

If so you can find them in /srv/www/<site>/logs.

If not, it completely depends on your setup.


#3

Thanks Scott, that helped me find the error logs.

Looks some sort of redirection loop… any idea why this may occur? Or how to rectify?

2017/12/01 21:10:31 [crit] 1397#1397: *99 stat() “/srv/www/majacmedical/current/web/index.php” failed (5: Input/output error), client: 192.168.50.1, server: majacmedical.dev, request: “GET /favicon.ico HTTP/1.1”, host: “majacmedical.dev”, referrer: "http://majacmedical.dev/"
2017/12/01 21:10:31 [error] 1397#1397: *99 rewrite or internal redirection cycle while internally redirecting to “/index.php”, client: 192.168.50.1, server: majacmedical.dev, request: “GET /favicon.ico HTTP/1.1”, host: “majacmedical.dev”, referrer: "http://majacmedical.dev/"
2017/12/03 13:09:11 [crit] 1397#1397: *101 stat() “/srv/www/majacmedical/current/web/” failed (5: Input/output error), client: 192.168.50.1, server: majacmedical.dev, request: “GET / HTTP/1.1”, host: “majacmedical.dev”

2017/12/03 13:37:35 [crit] 1397#1397: *102 stat() “/srv/www/majacmedical/current/web/index.php” failed (5: Input/output error), client: 192.1682017/12/03 13:37:35 [crit] 1397#1397: *102 stat() “/srv/www/majacmedical/current/web/index.php” failed (5: Input/output error), client: 192.168.50.1, server: majacmedical.dev, request: “GET / HTTP/1.1”, host: "majacmedical.dev

2017/12/03 13:37:35 [crit] 1397#1397: *103 stat() “/srv/www/majacmedical/current/web/index.php” failed (5: Input/output error), client: 192.168.50.1, server: majacmedical.dev, request: “GET /favicon.ico HTTP/1.1”, host: "majacmedical.dev"
2017/12/03 13:37:35 [error] 1397#1397: *103 rewrite or internal redirection cycle while internally redirecting to “/index.php”, client: 192.168.50.1, server: majacmedical.d


#4

Would running “npm install” in another project folder potentially cause this?


#5

I doubt it.

browser cache

I wonder if a browser caching issue could be involved. You might try clearing your browser’s cache for this site, generally viewing it in incognito mode or private browsing tab, and maybe clear hsts headers.

.dev :arrow_right: .test

You might consider adjusting your dev site(s) to use .test instead of .dev. See details…

So, you’d edit site_hosts in group_vars/development/wordpress_sites.yml.

If you do this, consider whether you need to search/replace example.dev to example.test in your dev database. You could use wp-cli or a plugin like WP Migrate DB Pro.

Also, I’d recommend not defining wp_home and wp_siteurl in the env of wordpress_sites.yml so that Trellis will use its dynamic default values instead. Maybe you weren’t defining those values anyway.

MacOS High Sierra

Whether it’s relevant to this issue or not, you may want to check whether you are affected by this issue with the High Sierra filesystem.

/etc/hosts

You could double-check your local machine’s /etc/hosts files for any potential conflicting entries related to your dev VM’s IP (probably 192.168.50.5).

Reload or Destroy and Rebuild

If this is an older existing VM that you’ve started back up, maybe the issue would resolve itself if you were to export the DB (if you need it) and vagrant reload or vagrant destroy -f && vagrant up.


#6

Thanks Phil and Ben for your detailed responses.

I think this could be related to the High Sierra upgrade.

When ssh’d into the Vagrant box if I try to get into the Trellis folder I get this:

vagrant@majacmedical:~$ ls
ls: cannot access ‘trellis’: Input/output error

Will do some more work on this tomorrow, but maybe you’re right I need to export the DB and re-create the local machine.


#7

Yay! That High Sierra fix worked for me.

Thanks so much Ben! :slight_smile: