0

I have a Mediatemple server (Centos / Plesk) running LAMP in a live website.

I've seen tutorials explaining how to install nginx but I don't understand how it should be done in a live server.

If I'm not wrong I need to install nginx and run it on a different port to see that everything is working. Then when everything is working I switch its port to 80 and kill apache.

If this is the case., I have a few questions.

Will it work with php in parallel to Apache? (isn't there a changes in php configuration for nginx?).

How can I test https connections (they have dedicated port so I can't use a different port to make it work in parallel to apache.

I would appreciate any advice about installing, testing and switching to nginx on a live server without interrupting the current traffic.

Thanks, Niro

2 Answers 2

1

If you are running PHP in CGI or FastCGI modes then you should be able to share the binaries with Apache and nginx fine. If you use mod_php though you will need more work.

If you end up running two configurations of PHP on the same machine you need to ensure that they run in the same user context - mod_php will run scripts as Apache's user (often called "nobody" or "www-data" (www-data is the Debian default) or similar) and most CGI/FastCGI setups use suEXEC or such in order to run scripts under the security rights of the user that owns the script - this difference can create significant problems with regard to file ownerships and permissions.

For HTTPS: you can run on different ports fine - it is the server name that certificates are usually specific to. A web server process running listening on port 444 on the address 111.222.333.444 can use the certificate for "www.yourdomain.com" just as well as a process listing on 22.33.44.55 port 443.

Instead of trying to run it all on one machine though, I strongly recommend you instead install nginx on another machine or virtual machine and try migrating your systems to there for testing. Once you have done that, you will have a much better idea of what needs to be done to migrate the live site. Don't just play with your live servers and hope that the process will go smoothly first time around!

3

You can use it along side apache, yes. Your distro's package might complain about installing it alongside apache, but try to force it on there if necessary, and just change the ports used before trying to (re)start it.

http also uses a default port (80), just like https's port 443. Just specify a different port in your server (883, say) force the port in your browser (https://yourserver:883), and continue testing as normal.

When it all seems to work, stop nginx, set the ports to normal, stop apache, start nginx. Done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .