skip to Main Content

I’m a little confused about when to use nginx or apache.
As I see, a lot of people use nginx as proxy for apache2 that redirects to websites, but you can not do this with nginx vhost?
If I add nginx to my server should I have apache2 to my server? Or I should remove? It has any relevance if I remove Apache?

2

Answers


  1. You can have both Apache and Nginx web servers on your system, but you should take measures to avoid port conflicts:

    1. Ensure they don’t use the same ports in their configs

    or

    1. Have only one of them run and enabled as daemon at a time

    As for the reason why use both, here’s the article which explains one of the common reasons, and how to configure it:
    https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache

    Login or Signup to reply.
  2. Using NGINX without Apache is the best strategy in most cases. It is a very capable web server, on par (if not superior, thanks to 3rd party modules) to that of Apache. What’s guaranteed about it, is very light use of CPU and RAM compared to Apache. So why keep the bloatware? 🙂

    There is one major reason to keep Apache, and that is laziness to rewrite existing .htaccess to NGINX configuration format. Exactly laziness, because it takes nothing but time to learn how to approach NGINX configuration and rewrite stuff from Apache format.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search