Si vous rencontrez des ralentissements sur l’un de vos sites hébergés sur votre serveur privé, il est fort probable que votre service Apache ou MySQL ne soit pas optimisé selon votre serveur.
Cependant nous pourrons faire cette intervention pour votre service Apache ou MySQL de notre coté dans le cadre d’infogérance.
Accéder au fichier de configuration APACHE
Il faut tout d’abord commencer par vous connecter à votre serveur en SSH.
Par la suite, selon la version de linux dont vous disposez, il faut accéder au fichier de configuration Apache ainsi :
s’il s’agit d’un debian 5/6/ la modification apache est a faire dans :
- etc/apache2/httpd.conf
suivie par /etc/init.d/apache2 restart une fois les modifications effectuées.
s’il s’agit d’un debian 7 la modification apache est a faire dans :
- etc/apache2/conf.d/tuning-nuxit.conf
suivie par /etc/init.d/apache2 restart une fois les modifications effectuées.
s’il s’agit d’un debian 8 la modification apache est a faire dans :
- etc/apache2/conf-available/tuning-nuxit.conf
suivie par a2enconf tuning-nuxit puis par systemctl restart apache2.service une fois les modifications effectuées.
Accéder au fichier de configuration MySQL
la modification dans mysql se fait dans le fichier :
- /etc/mysql/conf.d/tuning-nuxit.cnf
puis /etc/init.d/mysql restart une fois les modification effectuées.
Modification à effectuer
Selon le type de serveur que vous avez, voici les modifications à effectuer au niveau de la configuration pour Apache ou MySQL :
VPS 2G
- Apache : Si vous utilisez le module prefork
<IfModule mpm_prefork_module>
ServerLimit 256
StartServers 5
MinSpareServers 5
MaxSpareServers 30
MaxClients 35
MaxRequestsPerChild 250
</IfModule>
Si vous utilisez le module event
<IfModule mpm_event_module>
ServerLimit 6
StartServers 2
MaxRequestWorkers 120
MaxConnectionsPerChild 2000
ThreadsPerChild 20
ThreadLimit 64
</IfModule> - MySQL:
[mysqld]
query_cache_type = 1
query_cache_size = 32M
join_buffer_size = 8M
tmp_table_size = 32M
max_heap_table_size = 32M
innodb_file_per_table = 1
innodb_log_buffer_size = 64M
innodb_log_file_size = 256M
innodb_buffer_pool_size = 64M
table_open_cache = 1024
open_files_limit = 100000
max_connections = 100
VPS 4G
- Apache : Si vous utilisez le module prefork
<IfModule mpm_prefork_module>
ServerLimit 256
StartServers 10
MinSpareServers 10
MaxSpareServers 50
MaxClients 80
MaxRequestsPerChild 250
</IfModule>
Si vous utilisez le module event
<IfModule mpm_event_module>
ServerLimit 10
StartServers 2
MaxRequestWorkers 200
MaxConnectionsPerChild 2000
ThreadsPerChild 20
ThreadLimit 64
</IfModule>
- MySQL:
[mysqld]
query_cache_type = 1
query_cache_size = 64M
join_buffer_size = 16M
tmp_table_size = 64M
max_heap_table_size = 64M
innodb_file_per_table = 1
innodb_log_buffer_size = 128M
innodb_log_file_size = 256M
innodb_buffer_pool_size = 128M
table_open_cache = 1024
open_files_limit = 100000
max_connections = 120
VPS 8G
- Apache : Si vous utilisez le module prefork
<IfModule mpm_prefork_module>
ServerLimit 256
StartServers 25
MinSpareServers 25
MaxSpareServers 70
MaxClients 150
MaxRequestsPerChild 250
</IfModule>
Si vous utilisez le module event
<IfModule mpm_event_module>
ServerLimit 10
StartServers 2
MaxRequestWorkers 200
MaxConnectionsPerChild 2000
ThreadsPerChild 20
ThreadLimit 64
</IfModule> - MySQL:
[mysqld]
query_cache_type = 1
query_cache_size = 256M
join_buffer_size = 16M
tmp_table_size = 256M
max_heap_table_size = 256M
innodb_file_per_table = 1
innodb_log_buffer_size = 512M
innodb_log_file_size = 256M
innodb_buffer_pool_size = 512M
table_open_cache = 1024
open_files_limit = 100000
max_connections = 120
VPS 16G
- Apache : Si vous utilisez le module prefork
<IfModule mpm_prefork_module>
ServerLimit 512
StartServers 80
MinSpareServers 80
MaxSpareServers 200
MaxClients 400
MaxRequestsPerChild 450
</IfModule>
Si vous utilisez le module event
<IfModule mpm_event_module>
ServerLimit 16
StartServers 2
MaxRequestWorkers 400
MaxConnectionsPerChild 2000
ThreadsPerChild 25
ThreadLimit 64
</IfModule>
- MySQL:
[mysqld]
query_cache_type = 1
query_cache_size = 512M
join_buffer_size = 32M
tmp_table_size = 512M
max_heap_table_size = 512M
innodb_file_per_table = 1
innodb_log_buffer_size = 1G
innodb_log_file_size = 256M
innodb_buffer_pool_size = 1G
table_open_cache = 1024
open_files_limit = 100000
max_connections = 120
VPS 24G
- Apache : Si vous utilisez le module prefork
<IfModule mpm_prefork_module>
ServerLimit 512
StartServers 100
MinSpareServers 100
MaxSpareServers 300
MaxClients 512
MaxRequestsPerChild 500
</IfModule>
Si vous utilisez le module event
<IfModule mpm_event_module>
ServerLimit 20
StartServers 2
MaxRequestWorkers 500
MaxConnectionsPerChild 2000
ThreadsPerChild 25
ThreadLimit 6
</IfModule> - MySQL:
[mysqld]
conf:
query_cache_type = 1
query_cache_size = 512M
join_buffer_size = 32M
tmp_table_size = 1G
max_heap_table_size = 512M
innodb_file_per_table = 1
innodb_log_buffer_size = 1G
innodb_log_file_size = 256M
innodb_buffer_pool_size = 1G
table_open_cache = 1024
open_files_limit = 100000
max_connections = 170