Can I run nginx and apache at the same time?

Here is my scenario:

Apache is running perfectly with SSL enabled and certs installed on port 443.

I would like to install nginx as well on the same machine. Both as a functional reverse proxy and a server on port 81 or 8443 (using the same cert used by apache)

I found plenty of solutions with nginx as primary server and apache as secondary. I don't want to mess with my existing apache configuration, so nginx will be secondary for me.


Solution 1:

Apache and Nginx can definitely run simultaneously. The default config will not allow them to start at the same time because they will both try to listen on the same port and the same IP.

However, you can easily either change the ports or ports and IPs, or IPs. There are various ways to make them run either one behind the other(usually Apache behind Nginx because Nginx will be the first entry point in the chain since it's faster for static resources, and Apache will then only be triggered for some advanced dynamic rendering/processing) or just side by side. Check this to start with: http://kbeezie.com/apache-with-nginx/