Location of Varnish startup/defaults file

Hi, I'm using a Bitnami AWS image (more specifically a Magento CE 1.9 one) and I'm trying to find the defaults file for Varnish. I've had a look at https://wiki.bitnami.com/Components/Varnish#How_to_change_the_configuration_file.3f and that explains where to find the "default.vcl" file but I'm pretty sure that's not the file I'm looking for.

I'm after the file that, in regular Linux distros, would be either /etc/default/varnish (Debian) or /etc/sysconfig/varnish (CentOS). According to http://stackoverflow.com/a/10907959/1493346 this is not an alternative to the .vcl file(s) but coexists with it/them.

The reason I'm looking for it is because I want to see what DAEMON_OPTS is set to, and potentially add or change one of the parameters.

I feel like I've looked everywhere! Please help....

Thanks
Doug

Hello @dougbean,

Note that we don't use Varnish from the system, we include it instead. All Varnish files are into /opt/bitnami/varnish/.
However, we don't include that file into our path. Anyway, we use a script to control the service ( /opt/bitnami/varnish/scripts/ctl.sh ). You can see how we add the Varnish options as VARNISH_LISTEN_ADDRESS or VARNISH_PORT into it. You could modify it if you want.

I recommend you to backup the file before modifying it.

I hope it helps

1 Like

Thanks, worked perfectly :slight_smile:

I'm glad you found it useful. Don't hesitate to ask any another doubt you have.

Regards.

Hi @dougbean @davidg,

I have a similar problem for using varnish with magento 2.1.8 in this post :
https://community.bitnami.com/t/varnish-on-magento-2-1-7-stack/50989

After many hours of Google is my friend, I think I found a solution but I have also to modify the /etc/default/varnish file and add a DAEMON_OPTS option (seems to need increasing the http_max_hdr )

As @dougbean say, I try to change the ctl.sh file in the varnish folder :

VARNISH_SERVER_ID=varnish
VARNISH_PIDFILE="/opt/bitnami/varnish/var/$VARNISH_SERVER_ID/varnishd.pid"
VARNISH_SERVER=/opt/bitnami/varnish/bin/varnishd
VARNISH_CONFIG_FILE=/opt/bitnami/varnish/etc/varnish/magento.vcl
VARNISH_SECRET_FILE="/opt/bitnami/varnish/etc/$VARNISH_SERVER_ID/secret"
VARNISH_PORT=80
VARNISH_WORKING_DIR="/opt/bitnami/varnish/var/$VARNISH_SERVER_ID"
VARNISH_STORAGE_FILE="/opt/bitnami/varnish/var/$VARNISH_SERVER_ID/varnish_storage.bin"
VARNISH_STORAGE_SIZE=1G
VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
VARNISH_LISTEN_ADDRESS=
VARNISH_OPTIONS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_PORT} -f ${VARNISH_CONFIG_FILE} $

I try to add a -p http_max_hdr=256 in the last line but still the same error...
Sorry for asking in this old post but your case is similar to mine.

Thanks

Hi,

Which is the error you find? Maybe adding that property does not actually solve the issue. Could you let us know more information about what is happening?

Best regards,

Javier J. Salmerón


Was my answer helpful? Click on :heart:

I dont't want to double post my problem (you already try to help me in the post I submitted)

My error is still a HTTP/1.1 503 Backend fetch failed when I do a sudo varnishlog or try my address with this link : http://www.isvarnishworking.com

I read many things for this kind of error and everyone found something different to solve this problem.

  • some need to change the .vcl configuration file and add parameters like : http://devdocs.magento.com/guides/v2.0/config-guide/varnish/config-varnish-configure.html

    Possible error installing Magento:

    Error 503 Service Unavailable
    Service Unavailable
    XID: 303394517
    Varnish cache server
    If you experience this error, edit default.vcl and add a timeout to the backend stanza as follows:

    backend default {
    .host = "127.0.0.1";
    .port = "8080";
    .first_byte_timeout = 600s;
    }

  • some need also to add -p parameters to the varnish starting script :
    http://devdocs.magento.com/guides/v2.0/config-guide/varnish/tshoot-varnish-503.html
    Error 503 Backend fetch failed
    Backend fetch failed
    To resolve this issue, increase the default value of the http_resp_hdr_len parameter in your Varnish configuration file. The http_resp_hdr_len parameter specifies the max header length within the total default response size of 32768 bytes.

DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
     -f ${VARNISH_VCL_CONF} \
     -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
     -p thread_pool_min=${VARNISH_MIN_THREADS} \
     -p thread_pool_max=${VARNISH_MAX_THREADS} \
     -p http_resp_hdr_len=65536 \
     -p http_resp_size=98304 \
     -S ${VARNISH_SECRET_FILE} \
     -s ${VARNISH_STORAGE}"

I try both without better result !

Sorry for digging old post but I thought the problem here was the same as mine.
Thanks

Hi,

We can try to reproduce the issue in order to help you solve it but we need more information about your configuration. Could you please provide us with the following pieces of information?

  • Are you using this application in the cloud ( such as AWS, Google, Azure, etc;) a native installer (such as Windows, Linux, etc.) or a Virtual Machine?
  • Which exact version of the application are you using?
  • Can you describe every modification you have performed on top of the default configuration?

Thank you for your kind cooperation.

Best regards,
Alvaro Recio