Frequently Asked Questions
For which general use-cases is Nginx better than using Squid?
What algorithm does Nginx use to load balance? Can it balance based on connection load?
Can I disable the buffering for the proxy => backend way or upload-progress feature?
Is it safe to use the development branch in production?
In general, all releases, development or otherwise tend to be quite stable. This site tries to run the latest development version at all times. Also Nginx users as a whole tend to be an "early adopter" crowd, so a large segment is using the bleeding edge version at any given point.
That being said, if you are genuinely concerned, it's generally best to wait at least a few days after a development release as critical bugs tend to show up in the first two days (and we usually see another release immediately following). If no new release shows up in two or three days, then most likely no one has found any critical bugs (but you might be the lucky first - make a debug log!).
$thing doesn't work (rewrite, proxy, location, ...)
e.g.: rewrite doesn't work OR unix:/$PATH OR ...
please look into [NginxDebugging] and look LINE BY LINE in the error log.
If you don't find the error gather yourself and try to explain your problem to IRC or ML.
Are there other similar webservers?
What most people mean by this question is "not Apache" or "lightweight". You can find many comparisons using Google, but most web servers fall into two categories: process-based (forking or threaded) and asynchronous. Nginx and Lighttpd are probably the two best-known asynchronous servers and Apache is undoubtedly the best known process-based server. Cherokee is a lesser-known process-based server (but with very high performance).
The main advantage of the asynchronous approach is scalability. In a process-based server, each simultaneous connection requires a thread which incurs significant overhead. An asynchronous server, on the other hand, is event-driven and handles requests in a single (or at least, very few) threads.
While a process-based server can often perform on par with an asynchronous server under light loads, under heavier loads they usually consume far too much RAM which significantly degrades performance. Also, they degrade much faster on less powerful hardware or in a resource-restricted environment such as a VPS.
Pulling numbers from thin air for illustrative purposes, serving 10,000 simultaneous connections would probably only cause Nginx to use a few megabytes of RAM whereas Apache would probably consume hundreds of megabytes (if it could do it at all).
Is support for chroot planned?
Unknown. You can always use OS-level features (BSD Jails, OpenVZ w/proxyarp on Linux, etc) to achieve a similar (or better) effect.
What about something like mod_suexec?
mod_suexec is a solution to a problem that Nginx does not have. When running servers such as Apache, each instance of Apache consumes a significant amount of RAM, so it becomes important to only have a monolithic instance that handles all your needs. With Nginx, the memory and CPU utilization is so low that running dozens of instances of it is not a problem. The equivalent Nginx setup to Apache/mod_suexec is to run an instance of Nginx as the user you would have normally suexec'd to and then proxy to that from your main Nginx instance.
It's also worth noting that since there is no mod_php (which is the usual module suexec is used to defend against), you can simply run your PHP FastCGI as the user you want it suexec'd to and be done (in fact, you could do this with Apache as well).
For which general use-cases is Nginx better than using Squid? And vice-versa.
In general nginx is mostly used as a reverse proxy and not as a caching proxy like Squid. The greatest advantage of nginx is in RAM and CPU usage on high load. I don't think that squid will give you better performance than nginx. Squid is mostly useful for caching of dynamic content for applications that cannot do it themselves.
Can someone expand on how to configure and test the IMAP module with a complete .conf file instead of just the IMAP stub?
Start with the configuration from [NginxImapProxyExample]. For detail information about different configuration parameters, see the [NginxMailCoreModule] page.
Example1: Using a php script on apache server as the auth backend
How to use nginx as SMTP proxy with a postfix backend?
Needs a cookbook entry.
What algorithm does Nginx use to load balance? Can it balance based on connection load?
Currently Nginx uses a simple round-robin algorithm, so it cannot balance on connection load. This may change in a future release.
There is also a third-party module that uses a different algorithm.
Many people have also requested that Nginx implement a feature in the load balancer to limit the number of requests per backend (usually to one). While support for this is planned, it should be pointed out that the desire for this feature is rooted in a misfeature of the application being proxied to (mostly Rails it seems) rather than a shortcoming in Nginx. Ideally this request should be refactored into a request that the backend be improved to better handle simultaneous requests.
Can I disable the buffering for the proxy => backend way or upload-progress feature?
Due the fact that many people ask:
- Can I disable the buffering for upload progress
- How can I make a upload progress displayed to the customer with nginx
- ...
Currently the only solution for this is a third-party module, but this is a planned feature.
