Forum: NGINX reverse proxy vs. stand-alone

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2974d09ac2541e892966b762aad84943?d=identicon&s=25 jemari (Guest)
on 2009-05-15 02:34
(Received via mailing list)
Hi everyone,

I am setting up a small VPS. My plan is to have nginx as a reverse proxy
to apache2 (running with mod-php). All other static files will be served
by nginx.

Does anyone know if there would be a significant difference in
performance and/or stability if I removed apache, and have nginx use
fcgi for php?

Thx.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,2049,2049#msg-2049
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-05-15 02:43
(Received via mailing list)
On Thu, 2009-05-14 at 20:24 -0400, jemari wrote:
> Hi everyone,
>
> I am setting up a small VPS. My plan is to have nginx as a reverse
> proxy to apache2 (running with mod-php). All other static files will
> be served by nginx.
>
> Does anyone know if there would be a significant difference in
> performance and/or stability if I removed apache, and have nginx use
> fcgi for php?

Yes, you'd save hundreds of megabytes of RAM by not using Apache, which
will undoubtedly affect performance in a positive fashion.

Cliff
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-05-15 07:30
(Received via mailing list)
On Thu, May 14, 2009 at 05:36:15PM -0700, Cliff Wells wrote:

>
> Yes, you'd save hundreds of megabytes of RAM by not using Apache, which
> will undoubtedly affect performance in a positive fashion.

Would not these megabytes go to php/FastCGI ?
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-05-15 09:57
(Received via mailing list)
On Fri, 2009-05-15 at 09:19 +0400, Igor Sysoev wrote:
> > > performance and/or stability if I removed apache, and have nginx use
> > > fcgi for php?
> >
> > Yes, you'd save hundreds of megabytes of RAM by not using Apache, which
> > will undoubtedly affect performance in a positive fashion.
>
> Would not these megabytes go to php/FastCGI ?

Not really.  PHP under FastCGI seems to use a lot less resources than
mod_php.   I assume this is because the number of threads is a constant
with PHP under FCGI.

I converted a Joomla site from Apache/mod_php to Nginx/FastCGI and went
from constantly consuming the full 256MB (and crashing the VPS) to using
only around 20MB of RAM.

Regards,
Cliff
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-05-15 17:08
(Received via mailing list)
On Fri, May 15, 2009 at 12:48:28AM -0700, Cliff Wells wrote:

> > > > Does anyone know if there would be a significant difference in
> with PHP under FCGI.
>
> I converted a Joomla site from Apache/mod_php to Nginx/FastCGI and went
> from constantly consuming the full 256MB (and crashing the VPS) to using
> only around 20MB of RAM.

Have you tried to set

StartServers     20
MinSpareServers  20
MaxSpareServers  20
MaxClients       20

?
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-05-15 18:24
(Received via mailing list)
On Fri, 2009-05-15 at 18:55 +0400, Igor Sysoev wrote:
> > > > > be served by nginx.
> > Not really.  PHP under FastCGI seems to use a lot less resources than
> MinSpareServers  20
> MaxSpareServers  20
> MaxClients       20

StartServers       3
MinSpareServers    3
MaxSpareServers   10
ServerLimit      10
MaxClients       10
MaxRequestsPerChild  2000

I tried both prefork and worker MPM.

Apache and PHP would still exhaust the 256MB RAM in the VPS once a week
or so and force a restart of the entire VPS.   Someone suggested that
using FastCGI with Apache might help, but I never got around to trying
it before switching the site over to Nginx.

Cliff
Fe1cbce6b6b3fa8f72c740c570774ede?d=identicon&s=25 AMP Admin (Guest)
on 2009-05-15 20:19
(Received via mailing list)
Cliff, what did your Core SEF for Joomla! from .htaccess look like after
converting to nginx?
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-05-15 20:47
(Received via mailing list)
On Fri, 2009-05-15 at 13:09 -0500, AMP Admin wrote:
> Cliff, what did your Core SEF for Joomla! from .htaccess look like after
> converting to nginx?

This is all I used:

http://wiki.nginx.org/NginxJoomla


It's someone else's site (my VPS), so I'm not 100% certain of any Joomla
settings (from the admin interface) might come into play.

Cliff
8258b301dc8e73c0ce419c61c1e21891?d=identicon&s=25 Claude Bing (Guest)
on 2009-05-15 20:53
(Received via mailing list)
Apache using PHP FastCGI uses a *ton* less memory than mod_php.  Granted
I
have 1GB of RAM serving 6 drupal sites, but with one site, it would
definitely take less than 256 MB

On Fri, May 15, 2009 at 8:38 PM, Cliff Wells <cliff@develix.com> wrote:

> settings (from the admin interface) might come into play.
>
> Cliff
>
>
>
>
>


--

Bill Cosby <http://www.brainyquote.com/quotes/authors/b/bill_c...
-
"Fatherhood is pretending the present you love most is soap-on-a-rope."
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-05-15 20:55
(Received via mailing list)
On Fri, May 15, 2009 at 11:38:34AM -0700, Cliff Wells wrote:

> On Fri, 2009-05-15 at 13:09 -0500, AMP Admin wrote:
> > Cliff, what did your Core SEF for Joomla! from .htaccess look like after
> > converting to nginx?
>
> This is all I used:
>
> http://wiki.nginx.org/NginxJoomla

This

  location / {
    expires 30d;
    error_page 404 = @joomla;
    log_not_found off;
  }

  location @joomla {
    rewrite ^(.*)$ /index.php?q=$1 last;
  }

should be

  location / {
    expires 30d;
    error_page 404 = /index.php?q=$uri;
    log_not_found off;
  }

or

  location / {
    expires 30d;
    try_files  $uri  /index.php?q=$uri;
  }
Fe1cbce6b6b3fa8f72c740c570774ede?d=identicon&s=25 AMP Admin (Guest)
on 2009-05-15 21:20
(Received via mailing list)
I looked at that.  I'm not sure how that would take care of the pretty
urls
(Core SEF) part.  Oh wait... was it an older version or 1.5.x of Joomla?

Btw, thanks for your reply.
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-05-17 05:54
(Received via mailing list)
On Fri, 2009-05-15 at 14:09 -0500, AMP Admin wrote:
> I looked at that.  I'm not sure how that would take care of the pretty urls
> (Core SEF) part.  Oh wait... was it an older version or 1.5.x of Joomla?

It's a fairly recent install.    The SEF urls did work at one point, but
a Joomla upgrade broke that.

Cliff
2974d09ac2541e892966b762aad84943?d=identicon&s=25 jemari (Guest)
on 2009-05-17 18:13
(Received via mailing list)
Thanks to everyone for taking your time in replying.

My question was asked my Igor: how about the FastCGI php processes?
Would the difference be really that significant if nginx is serving all
non-php requests? In which case, apache doesn't need many modules?


Cliff Wells Wrote:
-------------------------------------------------------
> I converted a Joomla site from Apache/mod_php to
> Nginx/FastCGI and went
> from constantly consuming the full 256MB (and
> crashing the VPS) to using
> only around 20MB of RAM.

@Cliff
was your joomla site using nginx proxy before you converted to
Nginx/FastCGI?

--Jemari

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,2049,2115#msg-2115
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-05-17 22:56
(Received via mailing list)
On Sat, 2009-05-16 at 18:59 -0400, jemari wrote:
> Thanks to everyone for taking your time in replying.
>
> My question was asked my Igor: how about the FastCGI php processes?
> Would the difference be really that significant if nginx is serving
> all non-php requests? In which case, apache doesn't need many modules?

It's not the modules that make Apache bloat, it's the threads.   On the
site I mentioned, I removed almost every module I could.   It didn't
help.

Cliff
This topic is locked and can not be replied to.