Nginx as a Reverse Proxy for Apache

Using Nginx as the primary frontend webserver can increase performance regardless if you choose to keep Apache running on the system. One of Nginx’s greatest advantage is how well it serves static content. It does so much more efficiently than Apache, and with very little cost to memory or processing. So placing Nginx in front will remove that burdern off Apache, leaving it to concentrate on dynamic request or special scenarios.

Install nginx via brew

brew install nginx --HEAD

Install configuration and start-up files:
pkg nginx-configs.pkg

  EDIT$ open -e /usr/local/etc/httpd/httpd.conf

Set apache to listen on 8080 and edit the include line for sites as shown.

Listen 127.0.0.1:8080

IncludeOptional /usr/local/etc/httpd/sites/*.conf

$ sudo -s
$ apachectl -k restart
$ nginx

## stop-start-restart nginx
sudo -s
nginx
nginx -s stop
nginx -s quit
nginx -s reload; apachectl -k restart

TEST:
http://localhost
http://localhost/info.php
http://localhost/mailadmin/
http://localhost/phpmyadmin/
http://localhost/roundcubemail/

Edit APACHE site config file by replacing all instances of "exemple.com" with your domain name.

$ open -e /usr/local/etc/httpd/sites/example.com.conf

Also edit NGINX site config file by replacing all instances of "exemple.com" with your domain name and drop in your IP instead of '0.0.0.0:80'.

$ open -e /usr/local/etc/nginx/servers/example.com

When you finished editing site config files for both APACHE and NGINX with your domain name and IP the same folders will be availabe as shared on the server. Be sure to reload both Apache and NGINX.