Ubuntu server 12. Apache, MySQL, PHP
I've only ever used Apache. I know how to set up the Virtual Hosts and all that. But I have no idea how to add NGINX to the mix and not ruin everything.
I'm playing with a testing server, so it's ok if something goes down temporarily. What I would like to do is have ONE (or a few) of the testing sites on the server use NGINX while the others still use Apache. Is that even a thing? Can I use both on one server?
If not, then what I'd like to do is be able to switch between using Apache and NGINX serverwide. Could I install NGINX and easily switch between the two?
e.g. could I just stop Apache, start NGINX and have everything work smoothly (assuming NGINX is configured properly)?
I'm about to install nginx and I just want to make sure it doesn't break any existing configurations.
Yeah, that will work fine - the problem is that they'll conflict in terms of listening on standard ports; both use port 80 by default.
To run them at the same time, configure one to listen on a different port - or to have them use the same port, just make sure you stop one before starting the other.
Those are three questions, so you get three answers :)
Yes, you can run apache and nginx on the same server, provided they don't use the same source port/ip
Yes, you can make only one site use nginx. Easiest is to have multiple IP addresses so you can have an IP where nginx runs. Switching is then a matter of changing DNS records per site. Alternatively, you can run nginx on a different port. You can then even make apache forward to nginx so your customers don't see it (beware of logging issues, nginx thinks all connections come from localhost in this setup unless handled specially)
And finally, yes, if configured properly it's as simple as stopping apache and starting nginx (or vice versa) to switch between them. Configuring properly may take time though, depending on the compleity of the sites. The one-by-one approach sounds better to me