-
1. Re: How good is Nginx instead Apache
ctomc Jul 24, 2012 6:00 AM (in response to dcarpio)Hi,
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
--
tomaz