Performance Comparison Between Nginx + PHP and Apache + PHP

Source: Internet
Author: User

Performance Comparison Between Nginx + PHP and Apache + PHP

The test tool http_load has the same dynamic page for testing. With the same hardware resources, nginx + php has worse performance than apache + php and has the same concurrency and number of requests, in addition, if the request pressure is greater than the capacity of hardware resources, nginx + php will return a 502 status page in some requests, which means that the website is down (in the user's opinion), but apache will not, it's just that it takes a long time to open the website (also for Users)

Test result diagram of Nginx + PHP:

Test results of Apache + PHP:

Add nginx cache function to nginx + php

More than 4 times better than apache + php

Fetches/sec server requests per second

The time when msecs/connect requests call fees are completed.

Summary: When the hardware resources meet the requirements, apache + php is used because of its super stability. Of course, nginx + php is also good, and the hardware resources are insufficient. In addition, we want to solve the current website access pressure,

Nginx + php is a good choice

For more Nginx tutorials, see the following:

Deployment of Nginx + MySQL + PHP in CentOS 6.2

Build a WEB server using Nginx

Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5

Performance Tuning for Nginx in CentOS 6.3

Configure Nginx to load the ngx_pagespeed module in CentOS 6.3

Install and configure Nginx + Pcre + php-fpm in CentOS 6.4

Nginx installation and configuration instructions

Nginx log filtering using ngx_log_if does not record specific logs

Nginx details: click here
Nginx: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.