config droplet with 1 gb ram

December 13, 2015 439 views
Server Optimization Apache

Now i see in my account:
31492 admin 20 0 476776 31992 7996 R 13.0 3.1 0:09.67 apache2
31987 admin 20 0 461036 35220 3916 R 13.0 3.5 0:02.37 apache2
32038 mysql 20 0 894032 131044 2980 S 13.0 12.9 0:01.42 mysqld
32417 admin 20 0 478600 30152 4236 R 13.0 3.0 0:00.60 apache2
32418 admin 20 0 476248 27528 4236 R 13.0 2.7 0:00.67 apache2
32424 admin 20 0 479912 32928 5816 R 13.0 3.2 0:00.57 apache2
25 root 20 0 0 0 0 S 6.5 0.0 0:16.48 kworker/0:1
32408 admin 20 0 482228 37592 8300 R 6.5 3.7 0:00.78 apache2
32416 admin 20 0 480336 30932 4032 R 6.5 3.0 0:00.65 apache2
32422 admin 20 0 481356 41452 13952 R 6.5 4.1 0:00.65 apache2
32423 admin 20 0 465072 16364 4008 R 6.5 1.6 0:00.48 apache2

my apache2.conf

It is split into several files forming the configuration hierarchy outlined

below, all located in the /etc/apache2/ directory:

/etc/apache2/

|-- apache2.conf

| `-- ports.conf

|-- mods-enabled

| |-- *.load

| `-- *.conf

|-- conf.d

Global configuration

PidFile ${APACHEPIDFILE}
Timeout 30
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 10

<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 1
ServerLimit 16
MaxClients 100
MaxRequestsPerChild 1000
</IfModule>

<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 200
MaxRequestsPerChild 4000
</IfModule>

<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 200
MaxRequestsPerChild 4000
</IfModule>

These need to be set in /etc/apache2/envvars

User ${APACHERUNUSER}
Group ${APACHERUNGROUP}

User www-data

Group www-data

AccessFileName .htaccess

<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy all
</Files>

DefaultType None
HostnameLookups Off

ErrorLog ${APACHELOGDIR}/error.log
LogLevel warn

Include module configuration:

Include mods-enabled/.load
Include mods-enabled/
.conf

Include list of ports to listen on and which to use for name based vhosts

Include ports.conf

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%b" bytes

Include conf.d/

Include the virtual host configurations:

Include sites-enabled/

why correct config to me, because apache2 used very more cpu

1 Answer

Create a new question with a proper Syntax please. This post you just created isn't readable and you need to give some better detailed information and tell us exactly what you want to know.

Have another answer? Share your knowledge.