Tối ưu Apache Centos

30/03/2025

355 lượt xem

n this tutorial we’ll be optimizing the Apache server under VestaCP for better handling of requests, this will also speedup the site as requests are now handled more efficiently with this Apache MPM configs. By default under VestaCP Apache will be using mod_php and prefork mpm hence it is recommended to use prefork when using DSO. Prefork MPM uses multiple child processes with one thread each and each process handles one connection at a time. So it is recommended to optimize the value rather than using Apache default config. This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server that handles requests in a manner similar to Apache 1.3. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other. Lets get started with Optimization of Apache server under Centos and Ubuntu.

Centos :

Under Centos Open this file in editor:
typescript
1nano /etc/httpd/httpd.conf
2or
3nano /etc/httpd/conf/httpd.conf
And add this configs at the end of httpd.conf :
typescript
1KeepAlive Off
2<IfModule prefork.c>
3 StartServers 12
4 MinSpareServers 10
5 MaxSpareServers 30
6 ServerLimit 512
7 MaxClients 256
8 MaxRequestsPerChild 3000
9</IfModule>
Then restart apache server :
typescript
1service httpd restart

Bài viết liên quan

Nền tảng các kiến thức học tập

Cùng nhau học tập, khám phá các kiến thức nền tảng về Lập trình web, mobile, database nhé.

Nền tảng kiến thức - Hành trang tới tương lai hân hạnh phục vụ Quý khách!

Khám phá, trải nghiệm ngay
NenTang - Hành trang tới tương lai