At this point, you probably have the following architecture set up on your server:
- A web server application running on port 80, such as Apache
- A dynamic server-side script-processing application, such as PHP, communicating with your web server via CGI, FastCGI, or as a server module
The new configuration we are going towards will resemble the following:
- Nginx running on port 80
- Apache (or another web server) running on a different port, accepting requests coming from local sockets only
- The script-processing application configuration (PHP or Python, for instance) will remain unchanged
As you can tell, only two main configuration changes will be applied to Apache (or any other web server that you might be running). Firstly, change the listening-port number in order to avoid conflicts with Nginx. Secondly (although this is optional), you may want to disallow requests coming from the outside and only allow requests forwarded by Nginx. Both configuration steps are detailed in the next sections.