Hello,
After having been hit by a traffic-wave recently, I decided to switch
hosting of all my Jetty based web-apps to Nginx, replacing Apapche2.
One of these sites is for a type foundry, and the pages it servers
consist of many separate rendered gif files that are all requested
simultaneously. When loading these pages I could not help but feel a
decrease of performance in comparison to the previous Apache based
hosting, the amount of time it took to load the whole page simply seemed
lower, page rendering less fluid. So I switched back to Apache and
indeed, the page was loading much quicker. Here a link to such an
example page (currently served by Apache again):
(Clicking on any of the words will load another page, you will see what
I mean)
A day and many trials of improving the performance later I am not a bit
further. Nothing seems to improve the situation. And given all the
praise Nginx receives for the serving of static pages and the use as a
proxy I have a hard time believing it.
I’m on Debian Squeeze and was first using a package from Debian
Backports ( http://backports.debian.org/ ). I then later tried to
compile my own version, making sure epoll is in use, with no difference.
I tried many of the tips and tricks found online, made sure the static
files are indeed served by Nginx and not Jetty, and that none of the
described pitfalls apply ( Pitfalls and Common Mistakes | NGINX ), but nothing
has changed.
Could it be that for a low traffic site, Apache could actually
outperform Nginx noticeably in such a use case?
I’d hate to give up now, as I really like Nginx’s lightness and also the
way it is configured. Below the configuration in use. I hope somebody
can help me and shed some light on what’s going wrong.
Best,
Jrg
server {
server_name lineto.com;
root /srv/www/lineto.com/htdocs;
access_log /var/log/nginx/lineto.com.access;
error_log /var/log/nginx/lineto.com.error error;
location / {
proxy_pass http://localhost:8080/lineto/;
proxy_redirect default;
include proxy_params;
}
Just pass these through to root
location /img/ {}
location /js/ {}
location /1.0/ {}
Serve files with these extensions directly from root
location ~ .html$ {}
location ~ .css$ {}
location ~ .ico$ {}
}