Nginx (as SSL proxy) + Apache + Varnish

jaapsh

Verified User
Joined
Apr 13, 2016
Messages
10
Hello!

As alot of us might know Magento2 is fully compatible (native) with Varnish caching. The perfect solution for our stores would be a Directadmin powered server with:

PHP7
MariaDB
Nginx (SSL termination)
Apache
Varnish
Redis
Installatron or similar tool for backups / cloning.

My only real problem right now would be Varnish. For some reason I'm still failing in a correct setup. I guess lots of DA users would be very happy with a solid nginx, varnish, apache howto with SSL support :)

Anyone?
 
Not really, Ngninx do the cachine layer quite well as far as i know.

Sayd that, i'm using Varnish+Nginx+Apache this way:

Nginx Port 80 -> Varnish -> Apache
Nginx Port 443 -> Apache

I did this way to be able to use the .htaccess file, using ngninx_apache in CB and than modifiend the templates to Send Nginx request on port 80 to Varnish.

Best regards
 
Hello,

I wonder why would anybody here want to run Varnish for shared hosting in a scheme NGINX+Varnish+Apache? What can Varnish do which NGINX can not do? NGINX is good by itself with caching files, so why do you need Varnish? Why not to use Magento with Memcached without Varnish?
 
Well, that was why i said that Nginx do the same :D

I'm using this setup because i wanted to learn, is not in Prod for Shared Hosting, is just a repository server and it was just for personal learning :D

Best regards
 
Andrea,

Yes, agree with you. The question was mostly to the TS. ;)

Varnish is good for one project servers, where you use the server solely for one big portal or site, and in this case you can use Varnish native scripting language (VCL) for selective caching of site content. It's almost useless in shared hosting environment.

NGINX can cache files good enough, so there is no reason to use Varnish only for managing cache.
 
Thanks guys :)

To be a little bit more specific:

We are hosting 1 website only (Magento2 store) on this special server. I like to try and optimize this server to the limit using Directadmin as a base. Performance seems to be more and more important these days for SEO purposes.
Normally I would not use DA for this, but my colleques do not understand working in a command line interface environment. :rolleyes:
I have read alot about Nginx and Varnish and full page caching plugins for Magento2. Nginx is a very solid and fast solution and seems to be the perfect choice. Even better then using Nginx caching solutions according to the test below.

Check these speed tests for example. This is why I'm very much looking forward to use Varnish along side with Nginx!
http://cloudkul.com/blog/comparing-varnish-nginx-reverse-proxy-magento-2-store/
 
varnish_nginx

Thanks guys :)

To be a little bit more specific:

We are hosting 1 website only (Magento2 store) on this special server. I like to try and optimize this server to the limit using Directadmin as a base. Performance seems to be more and more important these days for SEO purposes.
Normally I would not use DA for this, but my colleques do not understand working in a command line interface environment. :rolleyes:
I have read alot about Nginx and Varnish and full page caching plugins for Magento2. Nginx is a very solid and fast solution and seems to be the perfect choice. Even better then using Nginx caching solutions according to the test below.

2016-12-15_1219.png


This is why I'm very much looking forward to use Varnish along side with Nginx!
 
Seems my responses are not being posted? Maybe because I added a link.

Anyway.
I'm setting up a server with 1 domain and website only. This server is 100% dedicated to serve 1 Magento2 store as fast as possible.
In several benchmarks available on the web varnish is much faster then nginx for Magento2 in particular. That's why I like to enable Varnish on my DA server.

I succeed in installing Varnish. Varnish is running. The only problem is the fact it will not listen on port 6081 (??)
When I start or restart varnish it does try to use the listen port located inside the /etc/varnish/varnish.params file. I forwarded Nginx to port 6081 using the config file located inside cd /usr/local/directadmin/data/templates/custom
After this I did a ./build rewrite_confs

Varnish is still failing. For some reason nginx still keeps using a proxy pass directly to apache.
 
I've got varnish on TCP:6081

Code:
# netstat -ntpl | grep varnish
tcp        0      0 0.0.0.0:6081                0.0.0.0:*                   LISTEN      2007/varnishd
tcp        0      0 127.0.0.1:6082              0.0.0.0:*                   LISTEN      1997/varnishd
tcp        0      0 :::6081                     :::*                        LISTEN      2007/varnishd

and it's running fine with the port.

You might need to check and update /etc/varnish/default.vcl and /etc/sysconfig/varnish to meet your needs.
 
Back
Top