0

Centos 6

Already using Apache + Nginx on my Magento 1 sites on a dedicated server

For a Magento 2.2 site I want to run varnish

However after installing varnish - i saw in the instructions need to change listening port-

What I did is to keep apache on 8080 and change Nginx from 80 to 446 (443 is being using for SSL) and changed inside [Home]/etc/varnish default.vcl

from 8080 to 80

Stopped and Restarted Apache Nginx and Varnish however when I went to open the websites none of them are able to connect -

I checked varnish port

ps aux | grep varnish

Output I get is

[root@server ~]# ps aux | grep varnish varnish 6393 0.0 0.0 28932 5204 ? SLs 15:26 0:00 /usr/sbin/varni shd -a :6081 -f /etc/varnish/default.vcl -T 127.0.0.1:6082 -p thread_pool_min=50 -p thread_pool_max=1000 -S /etc/varnish/secret -s malloc,256M -P /var/run/varni sh.pid varnish 6403 0.0 0.7 316840 116444 ? SLl 15:26 0:00 /usr/sbin/varni shd -a :6081 -f /etc/varnish/default.vcl -T 127.0.0.1:6082 -p thread_pool_min=50 -p thread_pool_max=1000 -S /etc/varnish/secret -s malloc,256M -P /var/run/varni sh.pid root 11434 0.0 0.0 103320 904 pts/0 S+ 16:07 0:00 grep varnish [root@server ~]#

Shows 6081 and 6082 but not the port 80 I set

I read some other posts with people with similar problems but I dont have on my server the file changes mentioned in those server locations.

One more thing is that before today I has Varnish 2.1 but today I installed 5.2 - i didn't remoeve the version 2.1 but just followed instructions to install the 5.2 version - so can this be the cause and where else would varnish be getting those values for port setting?

Nginx - doesnt seem to work unless it's on port 80

Please can anyone help asap stuck on this all day

2
  • I managed to find another file that was here [Home]/etc/sysconfig filename varnish now it is matching same port number specified in default.vcl Please can someone clarify in default.vcl do i put localhost or the ip address of the domain name I want to use varnish for - backend default at the moment it is like this { .host = "localhost"; .port = "8081"; what I want to be able to do is enable varnish only for a particular domain which has the magento 2 site and keep the other magento 1 sites working on different domain using ngix is this possible?
    – jt9489
    Commented Jul 24, 2019 at 19:38
  • just to add i changed the varnish port to 8081 and reset nginx to 80 to open up live sites on the server which stopped working after i changed the nginx port
    – jt9489
    Commented Jul 24, 2019 at 20:16

1 Answer 1

0

use only one - apache or nginx. with varnish.

you have:

user -> nginx:80 -> nginx:443 -> vanish:8081 -> nginx:8080

one domain you proxy pass request back to varnish, for another domain you dont proxy pass, request goes to nginx only. that simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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