Apache is known as the first and most widely used http server software in the world because of its ability to handle many dynamic applications in large scalability. Furthermore, Apache supports many programming language, some of which are commonly used are PHP, Perl, and Python (complete list can be found at this page:http://projects.apache.org/indexes/language.html). NginX itself today has been used by many websites generally because of its resource usage friendly. This web server which was first introduced in 2006 was intended to serve static files and as proxy server. For that reason NginX does not require too much resources and needs third party plug-ins to support programming language other than C.

In outline, Apache itself is more than enough to run many programming applications, but the problem is default server memory usage by this software is a lot higher than NginX, which is great of serving static files but does not have the important Apache feature called mod_rewrite. Therefore, this tutorial will make Apache work together with NginX so both can perform great in static file and dynamic application, while memory usage can be reduced to be lower.

OS: CentOS 6

Install Apache
By default, Apache is already installed in system, but it is recommended to use the latest version.

Because there are few softwares needed by Apache are not available from CentOS 6 repository, we will use EPEL for additional repository.

MySQL will automatically create root password and written inside .mysql_secret file located in the same rpm directory. The password can be used for mysql_secure_installation, don’t forget to start the daemon before securing MySQL.

Install PHP

PHP is one of many programming languages that widely used to generate dynamic web page. Install packages needed by PHP first.

All finished. To add another domain, create vhost configuration as above for both Apache and NginX with root user, and create yournewdomain.com/public_html folder under wserver (user) directory with wserver user, not root.