I wrote a "total" conversion for DA to ditch Apache and make it work with Nginx and PHP5-FPM. I did this because of one customer who simply refused to get rid of DirectAdmin, because he wanted to be able to control all aspects of his machine without having to rely on a system administrator.
After implementing this conversion however, I discovered two things:
1. Nginx + PHP5-FPM is far superior than Apache with mod_php, in terms of memory and I/O usage. Nginx is simply a much faster, more efficient web server than Apache ever was, by several orders of magnitude.
2. DirectAdmin is so flexible, it actually allowed me to implement this conversion with relative ease!
So I went ahead and installed this on a few more machines that I manage, and I have to say the difference in performance is quite impressive!
Here are the highlights of what I wrote so far:
- Eliminates Apache completely (This is not another "nginx proxying apache" plugin)
- Nginx handles port 80 and 443, with full support for SSL as implemented by DirectAdmin (fully transparent)
- Support for Domain Aliases and Pointers
- Automatically detects the type of site installed by the customer, and implements a correct nginx template for it
- Support for page caching + purging, especially for Wordpress + The Nginx Helper plugin
- So far I wrote templates for the following systems:
- Wordpress (Full caching - Extremely fast!)
--- Wordpress Multisite (Full caching too!)
--- Joomla
--- Droopal
--- Magento
--- Generic PHP Site
- FPM Pools are "ondemand" meaning that the number of running processes are minimized
- Total user separation
- Support for "custom" configs (a config that the generator won't overwrite)
- Able to add/remove sites easily, taking effect immediately
- The .htaccess file is NOT (and never will be) supported, but with the templates above, it is not really needed anymore since "SEO Friendly" URL's are supported out of the box.
- Handles the most common php security issues
- Per user FPM pools + their own php settings, such as the ability to disable_functions per pool, or set other php values per pool, which makes things way more flexible and more secure.
- phpMyAdmin & RoundCube are supported out of the box for all sites "as usual"
- Utilize all the tricks in the Nginx books to optimize access to static files!
Here's what I plan to add in the future:
- Special Nginx page in the panel to:
--- Control per site Nginx caching on/off
--- Specify cookie names & paths that disable caching
--- Button to purge the cache
--- Control rate limiting
--- Password Protect directories
- Support for media streaming with seek support
- Support for memcache caching (Currently caching is done either to the disk, or to a tmpfs ramdisk)
- More templates, including one for Magento that offers the full page cache for extreme performance
- Detect when components like W3 Total Cache generate an nginx.conf and include it automatically
- Detect when custom nginx.conf files are gone, and repair the configs so as not to break nginx
- Support for hot-linking protection for an entire site or per directory
How this conversion works:
I basically tapped the 4 custom templates, and made them generate nginx configurations and php5-fpm configurations in all the right places. More importantly, I have achieved a "sane" and working Nginx and FPM configuration settings that make the sites function really well, allow large file uploads, long running php scripts, and either reduce or completely eliminate Bad Gateway errors (so far I don't see any). This took weeks of painstaking research into nginx and php5-fpm minutiae.
I'm considering releasing this to the public on my own gitlab site, so anyone can fork it, modify it, and enjoy my efforts, but I would love to first get some developers who use DA to join me on the project as developers/testers, and possible contributors to fix the code to make it more flexible, configurable and robust. I don't want someone to think it is a "shelf product" that can just be installed and life is suddenly "pink". Sure, if I install it for you myself it will work great, but there is no "readme" or "install.txt" right now
So if you are a PHP developer and you're interested in contributing, contact me and I'll interview you about your setup and experience, and consider you for this early pilot.