magento2: Varnish does not appear to be configured for a public folder web root (at least, with NGINX)
Preconditions
- Magento 2.4-develop
- Varnish 4/5/6
Steps to reproduce
- Set up a server according to the provided recommendations, with NGINX as the HTTP host and using the public folder
- Export varnish as shown by Magento
- Install varnish configuration
Expected result
- Server works
Actual result
- Varnish doesn’t work (specifically, it returns a 503 and complains about upstream being down). Additionally, there are a bunch of messages in the NGINX error log about “404 /pub/health_check.php not found”
File is here: https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/PageCache/etc/varnish5.vcl
As you can see, it has the pub hardcoded. I might suggest doing detection in the application, and adjusting the probe root accordingly.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (12 by maintainers)
How is this still open after multiple years? Or maybe we’re all expected to investigate the exported VCL file and catch the error ourselves?
This is still an issue.
Preconditions
pub— the proper way to run PHP apps)Steps to reproduce
Expected result
Actual result
pubin them for whatever reasonSpecifically the following lines:
Line 12:
.url = "/pub/health_check.php";(why is /pub there? of course backend origin is going to 404, making Varnish think that the node is down…)Line 65:
@rou9e Thanks that helped! Got probe working now instead of removing it! 👍
There is some point that need to be fixed also in 2.4
Also magento webserver log show this that has no sense for me:
varnish server is the only one getting 404 result
Any idea? Restarterd fpm and nginx. I can reach the page with a browser and get a 200 status
@andrewhowdencom, thank you for your report. We’ve created internal ticket(s) MAGETWO-83718 to track progress on the issue.