Using Apache as a nginx PHP processing background

Source: Internet
Author: User
Keywords Php apache nginx processing backstage
Tags apache blocked configure high host html http install

Nginx itself does not own PHP processing module, so need to configure the reverse proxy, the PHP request to the other PHP parser execution, and then return the results to Nginx.

The current fashion is to configure the PHP processing service in a fast-cgi way. The advantages are relatively simple, the server load is light. But the downside is obvious: the PHP processing state cannot be viewed.

such as 8630.html "> Sometimes the site because the load is too high, the PHP processing thread has been all blocked, will cause the Web site can no longer respond to PHP services. Using the FastCGI method, you cannot see which script processing time is too long, blocking the PHP processing thread.

and http://www.aliyun.com/zixun/aggregation/14417.html ">apache a bit is that you can see which PHP script processing time is too long, blocking the number of effective processes."

The following way is to use Apache's most nginx php processing backstage:

1, first install Apache
Apt Install Apache
and configure Apache to run correctly on port 8001.

2, modify the Nginx of the virtual host configuration, other PHP scripts to the Apache resolution

Location ~ \.php$ {
Proxy_pass http://127.0.0.1:8001;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
Proxy_connect_timeout 30;
Proxy_send_timeout 30;
Proxy_read_timeout 30;

Client_max_body_size 10m;
Client_body_buffer_size 128k;
Proxy_buffer_size 4k;
Proxy_buffers 4 32k;
Proxy_busy_buffers_size 64k;
Proxy_temp_file_write_size 64k;
}

It's good to restart Nginx and Apache.

Note that if you want to view the processing state of PHP, you can install the Apache monitoring module.

From Nginx Chinese web: http://www.nginx.com.cn/?p=351

Related Article

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.