Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We've just moved a website of ours over to a brand new high-spec Linux server (1x Intel Xeon E3-1230 v2 @ 3.30GHz, 8GB DDR3 ECC, 2x 128GB SATA SSD RAID1).

The server has been configured to use nginx but we're not sure if its working correctly. The site always loads very fast to us (http://www.onedirection.net), but Plesk often sends us reports that the Apache CPU usage percentage reaches high leves, yet when we look at the nginx percentage it's always very low.

We've come from a Windows background so are very new to Linux, but shouldn't nginx run INSTEAD of apache?

Here's a screenshot from Plesk showing the CPU usage: http://www.pixelkicks.co.uk/_download/plesk.JPG

The website gets around 20,000 visitors per day, and we use W3 Total Cache to get it running as fast as possible. MySQL has been optimised well.

Memory usage is only running at 2GB of the 8GB.

Does this look right? How can we tell that nginx is doing most of the work?

Thanks,

Chris.

share|improve this question
    
Which one are you running, Apache or Nginx or both? –  Lucas Kauffman Jun 25 '13 at 9:30
    
You could just get on the console and look at the real configurations of the two services, but as your from a windows background and using plesk, I bet you probably would need to read into those topics first. And those would be critical, as most debugging would happen on CLI, not some web-interface like plesk.. –  MKzero Jun 25 '13 at 9:31
    
Oh and btw, it seems your nginx is only running as Proxy for Apache. You can read that on the graph you linked. –  MKzero Jun 25 '13 at 9:40
    
I would not be surprised that nginx does the same work then apache, but with much less resource consumption. After all, that was the main reason for the development of nginx. –  Isaac Jun 25 '13 at 10:47
    
That's right, we are not very comfortable with linux yet. We had an external person configure the server for us, but we're not sure if it's performing as well as it should. I think that both Apache and Nginx are concurrently running. We are fine editing via command line using nano. –  Buckers Jun 25 '13 at 13:02

1 Answer 1

up vote 1 down vote accepted

Apache's "high" CPU usage here is not actually attributable to Apache, but to PHP, which is actually loaded as a shared object within the Apache executable. Thus, the CPU time taken up by your WordPress and any other running PHP scripts gets attributed to Apache, since PHP runs within Apache's process.

In this scenario there's no real need to have Apache at all. A typical nginx setup would have nginx as the origin server and php-fpm (which runs PHP as separate processes) running the PHP scripts. Sample configurations for nginx and php-fpm are given on WordPress's own wiki, and W3 Total Cache will generate its own configuration snippets for nginx.

Using an nginx + php-fpm configuration also gives you an advantage in that it's easier to pinpoint slow PHP scripts, as the php-fpm SAPI contains slow script logging ability (and no other PHP SAPI does).

share|improve this answer
    
Thanks for your advice Michael, I'm doing a spot of reading on the Wordpress wiki. This might be a job we'll have to get someone to configure for us - we want to get things working as fast as possible. –  Buckers Jun 25 '13 at 19:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.