как пример выкладываю свои конфиги на примере debian
/etc/hosts
--------------------------------------------------------------------
127.0.0.1 localhost
127.0.1.1 tdog.tdog.ru tdog
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
-----------------------------------------------------------------------
/etc/apache2.conf
Раскачегариваем апач чтоб работал под нагрузками
тут меняем параметры это для производительности, все цыфровые параметры ставим как у меня
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 30
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
# graceful restart. ThreadLimit can only be changed by stopping
# and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
-------------------------------------------------------------
/etc/apache2/sites-available/default этот конфиг у Вас может называться по другому
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ServerName wow.tdog.ru
ServerAlias
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
----------------------------------------------------------------------------------------
/etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
----------------------------------------------------------------------------------------
Далее раскачегариваем мускуль
/etc/mysql/my.cnf
правим дефолтные цыфровые параметры и делаем как у меня
#
# * Fine Tuning
#
key_buffer = 32M
max_allowed_packet = 64M - тут можно больше у себя оставил так
thread_stack = 192K
thread_cache_size = 24
query_cache_limit = 32M
query_cache_size = 32M
expire_logs_days = 4
max_binlog_size = 64M
[mysqldump]
quick
quote-names
max_allowed_packet = 64M - можно больше
key_buffer = 24M
-----------------------------------------------------------------------------
Еще полезно поставить мемкешед и акселератор кеша
Перво-наперво обновляем список пакетов:
Выполняем в консоли:
apt-get update
apt-get install build-essential
apt-get install libpcre3-dev
apt-get install openssl
apt-get install libcurl4-openssl-dev
apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-json php5-mcrypt php5-memcache
Далее заходим в '/etc/php5/cgi/php.ini', где добавляем строку в конец файла:
cgi.fix_pathinfo = 1
Ставим акселератор
apt-get install php5-dev
Теперь скачиваем и устанавливаем eAccelerator:
cd /tmp
wget httр://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xvfj eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
phpize
./configure
make
make install
Создаем конфигурационный файл '/etc/php5/conf.d/eaccelerator.ini' следующего содержания:
extension="eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="1800"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
Создаем папку для хранения файлов eAccelerator'а:
mkdir -p /var/cache/eaccelerator
chmod 0777 /var/cache/eaccelerator
Перезапускаем php:
/etc/init.d/php-fastcgi restart
----------------------------------------------------------------------------------------------------------------------------------
Устанавливаем мемкеш:
apt-get install memcached
Перезапускаем php ещё раз:
/etc/init.d/php-fastcgi restart
/etc/init.d/mysql restart
/etc/init.d/apache2 restart
выполните в консоле и посмотрите сколько висит процессов
ps aux | grep apache | wc -l
если больше 30 то doss
netstat -n -t | grep SYN_RECV | wc -l
если больше 500 то это ddos