Apache and NGINX on the same server

Hi everybody,

I’m new to this board and new to webmin/virtualmin as well.
I have a brand-new CentOS server with one public IPV4 address and a fresh set-up Webmin/Virtualmin. At this time, the system is not productive, and no public website is running on it. So we can try.

We have several Wordpress/Joomla-Installations (about 100) so I would prefer using nginx as default webserver. for other websites, I have to run Apache (caused by the website’s structure).
Actually, I have installed both on the same mashine. I need some help in configuring both servers. Apache is working fine but I am not able to access a nginx-Website.

I want to create one virtual server running nginx and another one running Apache.

Is there a simple way to use both servers?
Thank you for your great support,



Alas, the problem is because there isn’t a simple way to do that :slight_smile:

In general, you’d want to use one or the other… Virtualmin doesn’t know how to configure both on the same server.

It’s not that both can’t run on the same server, but doing so is a more advanced setup… so it’s be something you’d need to configure manually. Virtualmin wouldn’t be able to assist you with that.

Some folks, for example, run Nginx on port 80, and Apache on an alternate port. They use Nginx to serve some sites (or even just some files within a given site), and send all other requests to Apache.

My suggestion would be to just use Apache.

However, if you wanted to explore using both on the same server, there’s a lot of articles describing such a setup… you could try Googling for something along the lines of “nginx and apache same server”. That’ll show some articles on running both services on port 80, along with other articles about using Nginx as a front-end proxy.


Hey Eric,

thank you for your reply. I think, Apache with NGINX as proxy should do.
I still don’t know how to configure the set-up.

All I want is to manage one Virtual Server (w/ NGINX as content delivery mashine for static content) and forward all dynamic things (like php) to apache:8080, i.e…
This has to work with one single setup, without configuring vhosts on both servers.

The issue: I have about 100 domains to be served by this installation (managed in only a few virtual servers).

Do you have an idea which how-tos will do?
Pls. do NOT reply “try searching” or “use google”… I know but haven’t the experience for that.

Thanks a lot!

Sorry, I’ve never attempted that setup, so I don’t know which howto is most likely to be able to help you.

The best I can offer would be to do some trial and error and see if you can find one that does what you’re after :slight_smile:

My suggestion though would be to just use Apache, as that’s far simpler.

However, perhaps someone who’s tried Nginx will chime in and offer some input on how they got the setup you’re describing to work.


Using nginx for “static content” and “forward all dynamic things to Apache” sounds to me like a very complex and hard to manage setup, if possible at all. You mentioned Wordpress and Joomla. Those ARE completely dynamic, everything they do relies on PHP, and I doubt they’re meant to be split between two web servers like you intend. If you need static page caching, they have built-in caching functions, and/or you can use PHP opcode caches like memcached or xcache.

I’m not sure I’d really want to use nginx, just for a slightly better static page performance, and for the price of a nearly unmanageable setup. Especially not if you’re not an expert with nginx yourself.

sorry to reply to that old post, but I’m surprised you don’t know the combo nginx for static files (images, js, css) + apache for everything else, it’s quite popular and not that complicated to implement. It’s a pity we can’t activate nginx and apache together in virtualmin, I can configure myself the nginx part, but would be much better if everything could be set from virtual min :frowning:

Here’s a guide that shows u in 5 steps how to get Nginx to serve the static resources (images, js, css, audio, video) and apache to serve the dynamic code (php).

About to try it out now, and compare response time performance. Should be noticeably better. certainly should use less memory/cpu than apache for serving those pesky static resources…



Would you mind posting your performance and response time findings once you have them? I’m curious :slight_smile: