Port related query about installing NGINX as a front end proxy for apache on a LAMP installation with Varnish already installed and working

Hi all,

I have apache 2.4 and varnish 4.0 already installed on a Ubuntu 14.04 x64 LAMP system.
Apache2 runs on port 8888 and Varnish runs on port 80 (standard configuration).

I found this tutorial on Digital Ocean: https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-front-end-proxy-for-apache

I am interested in installing NGINX as front end proxy for apache but I see it needs NGINX to listen to port 80 and apache to listen to port 8080, both of which are occupied at the moment (80 by Varnish and 8080 by ISPConfig3)

My question is, since my apache is already up and running on port 8888, would that mean that my nginx will now need to listen to port 8888 and my apache will need to be on some other port?

thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why would you need nginx as well - bit confusing?
Whats the purpose?

You would be better off just ditching Apache and using nginx
badwolfffAuthor Commented:
If you read the article you will see why.
Anyway do you know the answer to my query.
I would like to get this stuff working and test it.
If it is not satisfactory, I have a snapshot of my server and I can revert back to it easily.

Yes I have read and seen that tutorial before.

But there is no benefit as you already have Varnish as the front end proxy.

The only reason for this would be if you didn't already have Varnish and wanted a quicker server for static content.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Anyway you can set nGinx to listen on any port that Varnish is configured to send to
Then in nGinx you just set the port that Apache is listening on

But a waste of time really for no benefit.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nginx can replace varnish or apache or both.
badwolfffAuthor Commented:
Hi Gheist,

so you suggest I abandon varnish+apache2 solution totally and fall back on nginx+apache2 or just nginx for better results?

The above is rubbish
Varnish uses an in memory cache so will always be faster - assuming you are not restarting your server every day.
Nginx is faster than Apache so will always be better, though the config can be a bit apprehensive at first if you are used to Apache.

Varnish in front of nGinx makes the most sense

Varnish->Nginx->Apache - makes no sense, if set up correctly Varnish should be serving all your content, having nginx as a middle layer is just adding more complexity.
The nano seconds you gain by having nginx serve static content (where no cache exists) is lost by having to send everything else onto Apache to serve.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.