Setup nginx_apache reverse proxy
With the nginx_apache reverse proxy, static files are served by Nginx and PHP files are processed by Apache, thus overall performance is improved.
And yes, the setup is fully compatible with .htaccess files.
In general, the schema is:
- A new connection arrives and Nginx handles it. If it is for a static file (not a PHP script), go to step 2, else go to step 3.
- Nginx serves the static file to the user.
- Nginx forwards the file to Apache. Go to 4.
- Apache handles the PHP request - it tells PHP-FPM to compile it (if it is in FPM mode). Go to 5.
- Apache returns the output of the script to Nginx. Go to 6.
- Nginx returns the file back to the user.
To install nginx_apache, do the following:
./build set webserver nginx_apache
As Nginx and Apache are working simultaneously, if any modifications are necessary (such as the creation of a wildcard subdomain, automatic Webmail subdomains, etc), you must apply the necessary edits to both Nginx and Apache. Use appropriate sections in this guide for instructions.