3

I getting this error how can i do? i try to editing many time but still not work.

Error 503 Backend fetch failed
Backend fetch failed

Guru Meditation:
XID: 35

Varnish cache server

My CentOS 7: /etc/varnish/varnish.params

# Varnish environment configuration description. This was derived from # the old style sysconfig/defaults settings

# Set this to 1 to make systemd reload try to switch VCL without restart. RELOAD_VCL=1

# Main configuration file. You probably want to change it. VARNISH_VCL_CONF=/etc/varnish/default.vcl

# Default address and port to bind to. Blank address means all IPv4 # and IPv6 interfaces, otherwise specify a host name, an IPv4 dotted # quad, or an IPv6 address in brackets. # VARNISH_LISTEN_ADDRESS=192.168.1.5 VARNISH_LISTEN_PORT=80

# Admin interface listen address and port VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 VARNISH_ADMIN_LISTEN_PORT=6082

# Shared secret file for admin interface VARNISH_SECRET_FILE=/etc/varnish/secret

# Backend storage specification, see Storage Types in the varnishd(5) # man page for details. VARNISH_STORAGE="malloc,1024M"

# User and group for the varnishd worker processes VARNISH_USER=varnish VARNISH_GROUP=varnish

# Other options, see the man page varnishd(1) DAEMON_OPTS="-a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,1024m -p thread_pool_min=5 -p thread_pool_max=500 -p thread_pool_timeout=300 -p http_resp_hdr_len=65536 -p http_resp_size=98304 -p workspace_backend=98304"

update:

1) Yes, the vcl file generated by Magento.

2)

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4338/varnishd

tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 4337/varnishd

tcp6 0 0 :::80 :::* LISTEN 4338/varnishd

tcp6 0 0 :::8080 :::* LISTEN 3905/httpd

3) i in vcl edited added http:// beacuse when i only /pub/health_check.php will be 503, but added http:// the theme look like something wrong no css.

.probe = {. url = "http://example.com/pub/health_check.php";

4) i used this command

curl -I -v --location-trusted 'http://example.com'

show this, but i dont know working or not working, beacuse the var/page_cache/ directory is not empty. the mage-tags file still here.

< X-Magento-Cache-Control: max-age=0, must-revalidate, no-cache,no-store

X-Magento-Cache-Control: max-age=0, must-revalidate,no-cache, no-store < Age: 0 Age: 0 <

X-Magento-Cache-Debug: MISS

X-Magento-Cache-Debug: MISS

0

"Error 503 Backend fetch failed" errors usually mean two things:

  • Varnish is not able to fetch the response from Magento due to configuration issues
  • There is an issue on Magento side. Magento sends 5xx HTTP response code.

Varnish configuration issues

There are bunch of configuration issues, but most common are:

  • default default.vcl file is used. Make sure you take the vcl file generated by Magento
  • wrong backend specified in vcl file. Check the port and ip address specified in vcl file. I found netstat -tnulp useful tool to check the running services and their ports
  • Your Magento instance is not in web_root. Check every relative path in vcl file and add corresponding prefixes(health check file, media files...).

You need to restart varnish after every change.

Magento related issues

Usually, they are about some file permissions. In order to find exact issue, you need to skip varnish and visit the web server directly - http://your_domain.com:{web_server_port}/. Then you can turn on Magento developer mode in console using ./bin/magento deploy:mode:set developer command and uncomment ini_set('display_errors', 1); line in app/bootstrap.php. After all these actions you should see the exact error message

  • I updated original post 1,2,3,4, please check,thank you – niceonelee Dec 29 '17 at 17:05
  • You have magento2 chunk in URL. Just add magento2/ prefix to all relative paths in vcl file. E.g. probe_url = domain.com/magento2/pub/health_check. Also, make sure you switch page cache to varnish in magento admin panel – Andrey Konosov Dec 29 '17 at 17:11
  • but added http:// the theme look like something wrong no css. And no, my magento in public_html , domain.com/magento2 <-is for exsample. What is your mean? switch page cache to varnish in magento admin panel ? is Cache Management? thank you – niceonelee Dec 29 '17 at 17:16
  • sorry what is switch page cache to varnish in magento admin panel ? is Cache Management? thank you – niceonelee Dec 29 '17 at 17:38
  • The setting is located in Stores -> Configuration -> Advanced -> System -> Full Page Cache. There is no need to specify http before paths. Instead, it should be the relative path to Magento. – Andrey Konosov Jan 2 '18 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.