Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grav and nginx-unit. #2664

Open
eleksir opened this issue Sep 7, 2019 · 7 comments
Open

Grav and nginx-unit. #2664

eleksir opened this issue Sep 7, 2019 · 7 comments
Labels

Comments

@eleksir
Copy link

eleksir commented Sep 7, 2019

There is application server called nginx unit, it is capable to run php applications.
It successfully runs wordpress, roundcube, tiny-tiny rss, etc.

But if ona wants to run Grav on this app server, it will fail with error:
PHP webserver requires a router to run Grav, please use: <pre>php -S webserver.local:80 system/router.php</pre>

You just need to pick alpine linux 3.9 with it's php7, unit-php7 and nginx to reproduce this.

@rhukster
Copy link
Member

rhukster commented Sep 7, 2019

Try commenting out this check https://github.com/getgrav/grav/blob/develop/index.php#L19

@eleksir
Copy link
Author

eleksir commented Sep 7, 2019

if commented out - everything works fine.

@rhukster
Copy link
Member

rhukster commented Sep 7, 2019

I need to find some identifier from the nginx unit so it can skip that check.

@eleksir
Copy link
Author

eleksir commented Sep 7, 2019

ahhh, deeper checks discover that grav says

Error 404
PLUGIN_ERROR.ERROR_MESSAGE

how to debug it deeper - i don't know.

@eleksir
Copy link
Author

eleksir commented Sep 7, 2019

logs/grav.log is empty
nginx access.log says that my root url got 404 (i place grav under /wordpress/ on my site)
nginx error.log is empty
unit.log empty too

@eleksir
Copy link
Author

eleksir commented Mar 31, 2020

I see traditional E_NOROGRESS here.
It looks like there is some weirdness in directory traversal, that comes from error assumptions on "how it works".
What if i dig inside this problem and find solution?

@hughbris
Copy link
Contributor

I can confirm that I also encountered this when I tried to build a Docker image based on Nginx Unit. Commenting out the suggested check block did indeed fix this (thank you!). I can tolerate that hack while I'm still building up that image and it's just for my use.

I looked for variables in the PHP environment that might act as identifiers for @rhukster to test against but nothing stood out for me. From reading, it seems Unit should really be setting $_SERVER['PHP_CLI_ROUTER'] to 'embed'. If it did, this test would "pass".

If @eleksir is running Unit on the official docker images (no mention of docker so I'm assuming), then there is an explanation for both of us. It seems the official PHP builds for Alpine excluded the embed module. There is a process to remedy this upstream so this issue might go away if we are lucky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants