V
V
Vitaly2017-09-22 12:16:40
Python
Vitaly, 2017-09-22 12:16:40

What is Nginx or Apache for and what to choose?

All the best!
I read superficially how nginx and apache work... (into one non-blocking sockets, the other multi-process ....)
Here I am writing some kind of web service with a node or python backend, each of them has its own web servers, I know that I need to pass them through nginx, apache or fastcgi, but I don’t quite understand why and for what .... I know that it’s so right .... I don’t want to go deep into how they work (for now, because now I'm learning python and node)
Could you be so kind and explain why to do this and which server is better to use when?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vladimir Skibin, 2017-09-22
@megafax

In my practice, I use this approach:
nginx serves as a layer for projects on php / nodejs / etc, which distributes requests - to static (pictures, css, js) or dynamics (html). It gives away statics on its own, but apache/nodejs/etc is already taking care of dynamics. Moreover, only nginx looks "out", everything else listens only to 127.0.0.1, where it proxies all nginx requests.
This is in a nutshell, if you need more detail or fine tuning, then mana will help you.

V
Vitaly, 2017-09-22
@vitali1995

In short, nginx is better. It is developed later and takes into account many previously unforeseen problems. As a rule, apache is used where more flexibility is needed, but this may already be outdated information, because. nginx continues to evolve.
For your information: nginx also runs in several processes, while their number better matches the capabilities of the machine. At this time, apache creates new threads for each connection - and yes, this information may also be out of date, because. apache hasn't been buried yet.

A
Alexey Ovdienko, 2017-09-22
@doubledare

Nginx - and a proxy server, and a load balancer for several nodes and a filter by access and what else you want.
in the nginx vs apache battle, Nginx has been winning over the past 4-5 years in terms of performance.
Ndijncs listens on ports or sockets of your web project, and all incoming/outgoing requests go through it. Here you add filters, tune for statics, remotely listen to logs and monitor.
If you don't use php, then this is your bro, in php they usually manage with apache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question