cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple magento2 and wordpress on one IP

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Multiple magento2 and wordpress on one IP

Dear Members,

 

I've a very amateur problem, we have a server with 3 virtual hosts, two with Magento2 and one with Wordpress4. I used the generated Magento2 varnish4 config and for Wordpress4 I found one: https://github.com/nicolargo/varnish-nginx-wordpress/blob/master/varnish.

 

My question is, how can I assign the configs based on domain name?

 

wordpress1.com -> wordpress1.vcl

magento2 -> magento1.vcl

magento2 -> magento2.vcl

 

I tried this config:

#default.vcl:

vcl 4.0;

import std;

backend magento { .host = "localhost"; .port = "8080"; }

backend wordpress1 { .host = "localhost"; .port = "8090"; }

acl purge { "localhost"; }

if (req.http.Host == "magento1") { include "/usr/local/etc/varnish/magento1.vcl"; }

if (req.http.Host == "magento2") { include "/usr/local/etc/varnish/magento2.vcl"; }

if (req.http.Host == "wordpress1") { include "/usr/local/etc/varnish/wordpress1.vcl"; }

 

But I get the following error:

 

Starting varnishd. Message from VCC-compiler:

Expected one of 'acl', 'sub', 'backend', 'director', 'probe', 'import', or 'vcl'

Found: 'if' at ('input' Line 19 Pos 1)

if (req.http.Host == "magento")

{ ##--------------------------------------------

Running VCC-compiler failed, exited with 2

 

Do you have a working config for at least the two magento2 shop on the same IP?

 

Kind Regards,

bzg