1 Reply Latest reply on Jul 24, 2012 6:00 AM by Tomaz Cerar

    How good is Nginx instead Apache

    daniel carpio contreras Newbie

      Hi everyone. I need to configure a JBoss Cluster (with AS 7) but I have to use Nginx as web server because it's already installed in the place that I'm working. I have found that Nginx is faster and lighter that Apache but what I really want to know is how dificult is to configure Nginx in order to work with JBoss AS7 and how it's performance in production environment.


      I hope someone could answer my question. Thanks in advance.

        • 1. Re: How good is Nginx instead Apache
          Tomaz Cerar Master



          sure you can use nginx instead of apache, nginx has really powerfull configuration syntax and allows you to configure load balancing quite easy.


          There are some things you will need to know however.

          there is no mod_cluster support as it is apache module

          and you have to manualy configure proxy to forward appropirate headers


          you can read more about what you can do or even install some extra modules at nginx wiki http://wiki.nginx.org/JavaServers


          the basic configuration would be something like this:


          server {
              listen myhost:80;
              server_name  myhost;
              location / {
                  root /path/to/myapp/public;
                  proxy_set_header X-Forwarded-Host $host;
                  proxy_set_header X-Forwarded-Server $host;
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                  proxy_pass http://myapp:8080;

          but if you dig into nginx configuration and capabilites (caching, proxy-store-serve,...)

          you can get amazing perforamnce out of it.


          I was managing setup of 1500req/s with nginx proxying/load balancing to 6 jboss servers.

          but that was with lots of optimizations that nginx offers


          aka if you want performance you can achive it with nginx but you will need to get familiar with all the stuff nginx offers



          i see now that there are now some modules that support better(easier) integration with java backend server

          take a look at 3rd party modules http://wiki.nginx.org/3rdPartyModules

          and https://github.com/yaoweibin/nginx_ajp_module