# Nginx or apache for game

**URL:** <https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904>\
**Category:** NGINX\
**Created:** [February 9, 2013, 2:12am UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904 "2013-02-09T02:12:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mottwsc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b77776/32.png) [@mottwsc](https://www.ruby-forum.com/u/mottwsc)\
**Post date:** [February 9, 2013, 2:12am UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904/1 "2013-02-09T02:12:03Z")

</div>

We are building a web based game on a LAMP stack, but it could just as  
well  
be on a LEMP stack. The game does not involve a lot of typical game  
stuff -  
character movement, etc. - like in most video games. Instead, it  
involves  
some video clips and some html pages, with updates to content and chat  
supplied primarily using Ajax and jQuery. You can think of it like the  
app  
‘Are you smarter than a 5th grader’, but this is an HTML5 web-based  
application, not an app you download, and it has much more variety and  
functionality.

I’ve read that nginx is much better for static web pages and that apache  
is  
better for processing on the back end. Can anyone provide some guidance  
as  
to why it would be better to switch to nginx from apache for this type  
of  
game application?

Thanks!

Posted at Nginx Forum:

> **[nginx or apache for game](https://forum.nginx.org/read.php?2,236033,236033#msg-236033)**
>
> We are building a web based game on a LAMP stack, but it could just as well be on a LEMP stack. The game does not involve a lot of typical game stuff - character movement, etc. - like in most video games. Instead, it involves some video clips and...

---

<div class="post-metadata">

**Author:** ![mottwsc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b77776/32.png) [@mottwsc](https://www.ruby-forum.com/u/mottwsc)\
**Post date:** [February 9, 2013, 8:33am UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904/2 "2013-02-09T08:33:31Z")

</div>

On 2/8/2013 6:11 PM, mottwsc wrote:

> I’ve read that nginx is much better for static web pages and that  
> apache is better for processing on the back end.

I’m using OpenResty, and I would say that it gives me more performance  
than Apache (as an app server) would in ANY configuration. Possibly by a  
factor of 10-40, though I haven’t actually done an apples-to-apples  
benchmark – and I’m also using LuaJIT now instead of PHP, so that’s a  
HUGE speed advantage by itself (Lua being the FASTEST dynamic language  
around, and PHP being one of the slowest).

I’ve heard of people getting 70k+ concurrent connections per second  
using Lua (or LuaJIT maybe) and OpenResty. My low-end VPS can’t handle  
that many connections, but it easily handles 3k+ connections per second,  
including complex app logic.

YMMV.

Tim

---

<div class="post-metadata">

**Author:** ![mottwsc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b77776/32.png) [@mottwsc](https://www.ruby-forum.com/u/mottwsc)\
**Post date:** [February 10, 2013, 3:16pm UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904/3 "2013-02-10T15:16:02Z")

</div>

At this point for the beta, I’m using PHP - could switch to something  
else  
like Lua for a future production version. My best course for right now  
might be to use nginx on the front end and apache on the back end; could  
extend nginx to OpenResty, and could possibly use Varnish as well.

Anyone with experience in these areas, please comment.

Thanks.

Posted at Nginx Forum:

> **[Re: nginx or apache for game](https://forum.nginx.org/read.php?2,236033,236067#msg-236067)**
>
> We are building a web based game on a LAMP stack, but it could just as well be on a LEMP stack. The game does not involve a lot of typical game stuff - character movement, etc. - like in most video games. Instead, it involves some video clips and...

---

<div class="post-metadata">

**Author:** ![mottwsc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b77776/32.png) [@mottwsc](https://www.ruby-forum.com/u/mottwsc)\
**Post date:** [February 11, 2013, 10:08am UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904/4 "2013-02-11T10:08:52Z")

</div>

Am Mon, 11 Feb 2013 03:19:27 -0500  
schrieb “mex” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> and different implementations of nginx as frontend-gateway.  
> And which conference would that be?  
> Just out of curiosity?  
> 😉

---

<div class="post-metadata">

**Author:** ![mottwsc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b77776/32.png) [@mottwsc](https://www.ruby-forum.com/u/mottwsc)\
**Post date:** [February 11, 2013, 9:19am UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904/5 "2013-02-11T09:19:46Z")

</div>

tl;dr: yes 🙂

we run nginx as frontend (caching/loadbalancing/waf-functions via naxsi)  
in  
front of different setups  
(rails, tomcat, apache+php) and can recommend it, esp. the  
caching-function,  
if used with caution,  
might be integrated in parts of your application.

i’ll give a talk on this topic on an oss-conference soon and will  
release a  
paper with benchmarks  
and different implementations of nginx as frontend-gateway.

regards, mex

Posted at Nginx Forum:

> **[Re: nginx or apache for game](https://forum.nginx.org/read.php?2,236033,236071#msg-236071)**
>
> We are building a web based game on a LAMP stack, but it could just as well be on a LEMP stack. The game does not involve a lot of typical game stuff - character movement, etc. - like in most video games. Instead, it involves some video clips and...

---

<div class="post-metadata">

**Author:** ![mottwsc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b77776/32.png) [@mottwsc](https://www.ruby-forum.com/u/mottwsc)\
**Post date:** [February 11, 2013, 2:14pm UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904/6 "2013-02-11T14:14:52Z")

</div>

2013/2/11 mex [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> i’ll give a talk on this topic on an oss-conference soon and will release a  
> paper with benchmarks  
> and different implementations of nginx as frontend-gateway.

Hello,  
I would like to ask you to link the papers, when they’re online. I’m  
interested in reading them 🙂

Regards, André

---

<div class="post-metadata">

**Author:** ![mottwsc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b77776/32.png) [@mottwsc](https://www.ruby-forum.com/u/mottwsc)\
**Post date:** [February 11, 2013, 10:12am UTC](https://www.ruby-forum.com/t/nginx-or-apache-for-game/229904/7 "2013-02-11T10:12:57Z")

</div>

> And which conference would that be?  
> Just out of curiosity?  
> 😉

cebit 🙂

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,236033,236074#msg-236074](http://forum.nginx.org/read.php?2,236033,236074#msg-236074)
