B
B
Begetan2011-09-18 22:24:13
Nginx
Begetan, 2011-09-18 22:24:13

Which is better for the backend: Apache or FastCGI? Nginx will ALWAYS remain on the frontend

To run php projects, I now use the Nginx + Apache bundle . Now I'm going to install LiveStreet CMS, and there in the description it says that it works under both Apache and FastCGI. I wanted to get rid of Apache for a long time, so I decided to study the issue.

After reading articles a little, I saw an opinion that FastCGI does not affect performance in any way. We already have nginx, which solves the problem of slow clients, and what is behind it does not matter.

Is this the question? Are there any advantages to using FastCGI to run php frameworks over Apache?

Update
Please read the question more carefully. It's not about Nginx, but about what to put behind it.

Update Update
In the answers they persistently write that Nginx is better than Apache.
Gentlemen, well, read the same question. Changed title, last hope to see replies.

Answer the question

In order to leave comments, you need to log in

11 answer(s)
A
admin4eg, 2011-09-19
@admin4eg

on one of my very loaded site on Wordpress, I abandoned Apache aside ... php5-fpm
memory consumption has significantly decreased, there are no “stickings” in peak loads, the freed memory is gone mysql
Here I wrote for myself, so as not to forget
www.odmin4eg .ru/2010/pereezzhaem-na-php5fpm/

R
Riateche, 2011-09-18
@Riateche

Get rid of Apache. You will have one layer less. The resources that the Apache ate will be released. What exactly you run there in php does not really matter in this matter.

N
Nepofigist, 2011-09-19
@Nepofigist

I am using nginx+php-fpm. The server has 512 MB of RAM, 90% is occupied, most of which are cache and buffers. The site is powered by Livestreet and the blog is powered by Wordpress. Here are the statistics , plus here is an illustration (site characteristic on LS - on the left).

V
Vlad Zhivotnev, 2011-09-19
@inkvizitor68sl

Oh, what heresy they wrote in the topic.
A note from Bitrix is ​​slag, because in their case fcgi is launched via apache + mod_fastcgid when it comes to hosting.
As for the subject, there is no increase in speed (until you rewrite your application accordingly to work with fcgi). There is a saving of memory and processor time. Due to which, at high loads, you may end up with pages loading faster, yes. In general, it's not worth it - it's better to learn how to tune Apache, he will never leave the stage.

X
xaker1, 2011-09-18
@xaker1

Apache is a web server and it is not correct to compare it with FastCGI.
FastCGI is a way to run php. It differs from CGI in that the php process does not die after serving
the client, but waits for a new one (or dies without waiting for the client).
If we compare the request processing speed, we get the following relationship: CGI > FastCGI > mod_php. Those. the fastest is mod_php, then FastCGI, and CGI in losers.
If you want to get rid of Apache - act. Get more fault tolerance and performance (nginx is faster and has less memory).
ps As practice shows, any php script can work both on mod_php and on FastCGI. Haven't seen a rebuttal yet.

Z
Zaur, 2011-09-19
@zaurio

Before you leave Apache, think about what you will get. Not only buns, but also crap. Apache is a very high quality process manager. You are not going to switch to a fastcgi daemon that runs in a single instance. So, you need to study the topic “writing a process manager” (your own, ready-made - it doesn’t matter). The main thing is to make sure the stability of its work.
This applies not only to php, fcgi daemons can be written in different languages, and everyone has the task of managing processes. Someone solves it with forks, someone with a single worker and non-blocking sockets, these are the details. This is a wide choice before the developer, your hands are free. But you are not helped to ensure smooth operation, as Apache does (try to do).
And yes, I am in favor of getting away from Apache (there were problems in other areas), but life has become not easier, but “different”.

P
pentarh, 2011-09-19
@pentarh

Cool theme. Apache (backend) on direct hands works no worse than php-fpm, and in some things even better.
I disagree about the extra layer. What kind of Apache layer, if mod_php is loaded as a shared object? Then FPM in PHP is also a layer.
Plus, the Apache is hung with different buns. If you don't need it, turn it off. Which are needed — zatyunit. Well, there are xtaxes, mod_rewrites. Many scripts come with rewrites in .htaccess. A lot of software supports .htaccess goodies. If it's fun for you to port them every time to nginx - go for it.
I've been using Apache and php-fpm for a long time. I will say that Apache is a neat, tuneable reed, and fpm is a rough ax.
Set fpm in specific tasks that require FCGI goodies or so that each owner has his own pool of workers under his own ID. Well, it’s possible out of racial hatred for the Apache))) Only fanaticism will never lead to good and won’t fix crooked hands.

A
Alexander, 2011-09-19
@kryoz

why not consider lighttpd as another option?

S
shagguboy, 2011-10-12
@shagguboy

Apache
1) eats memory
2) doesn’t cluster,
but
1) is hung with a bunch of modules

E
Evgeny Bezymyannikov, 2012-10-30
@psman

www.pentarh.com/wp/2008/07/11/test-results-apache-vs-php-fcgi/ raise the topic

A
Anatoly, 2011-09-18
@taliban

If you want to get rid of Apache, then why are you asking? In general, both options have their advantages and disadvantages, in a nutshell, nginx is faster, and Apache keeps the connection more stable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question