11 2010
, - Debian
, - Debian .

Skripter.info . .
apache

:
deflate, expires, headers, php5, rpaf ( )

:

<Directory />
Options FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
NameVirtualHost *
Listen *:80
Include /etc/apache2/sites/


/etc/apache2/sites/ :

<VirtualHost *>
ServerName example.ru
ServerAlias www.example.ru
DocumentRoot /home/example.ru/docs/
ErrorLog /home/example.ru/logs/error.log
CustomLog /home/example.ru/logs/access.log combined
</VirtualHost>


. /etc/apache2/conf.d/optimize ( webo.in):

# Content-Type .gz
AddEncoding gzip .gz
# HTML- XML-⠠
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
# ( )
AddOutputFilterByType DEFLATE image/x-icon
# CSS- javascript-⠠
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# ( 񠠠
# , 7 1)
DeflateCompressionLevel 9
#
DeflateWindowSize 15
# ⠠
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Vary ,
# -
Header append Vary User-Agent
# - ,
# ,
<FilesMatch .*\.(css|js|php|phtml|shtml|html|xml)$>
Header append Cache-Control: private
</FilesMatch>
# Expires
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 week"
</IfModule>

# ETag
FileETag MTime Size


.

Nginx

apache :

Listen 127.0.0.1:8080


/etc/nginx/nginx.conf :

user www-data;
worker_processes2;

error_log/var/log/nginx/error.log;
pid/var/run/nginx.pid;

events {
worker_connections1024;
}

http {
include /etc/nginx/mime.types;
default_typeapplication/octet-stream;

log_formatmain'$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "http_x_forwarded_for"';
access_log /var/log/nginx/access.log;

sendfileon;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout30;

gzipon;

server {
listen 80;

location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
log_not_found off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP$remote_addr;
proxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;

client_max_body_size 10m;
client_body_buffer_size128k;

proxy_connect_timeout40;
proxy_send_timeout 90;
proxy_read_timeout 40;

proxy_buffer_size4k;
proxy_buffers4 32k;
proxy_busy_buffers_size64k;
proxy_temp_file_write_size 64k;
}
}
}


apache nginx. .

PHP

PHP, eaccelerator. php.ini

max_execution_time = 30
CPU-

max_input_time = 60
( )

memory_limit = 32M
( ) , . 64M

output_buffering = 4096
( ) ,


. , max_input_time php.ini, . , , CPU . , "" , . max_execution_time: , CPU , . , , / , , max_execution_time. max_input_time , max_execution_time.

, PHP, . , , . , , . error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR , , .

MySQL

:
MySQLtuner.sh tuning-primer.sh. my.cnf.

utf8 /etc/mysql/my.cnd ( ):

[client]
port = 3306
socket = mysql
default-character-set=utf8

[mysqld]
port = 3306
socket = mysql
skip-locking
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
default-character-set=utf8
character-set-server = utf8
collation-server = utf8_general_ci
[mysql]
default-character-set=utf8
key_buffer = 1M
max_allowed_packet = 2M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
query_cache_limit = 256K
query_cache_size = 4M


:

show variables like "%character%";
show variables like "%collation%";


- (. latin1):
1. :

alter database DBNAME default character set utf8 collate utf8_general_ci


:

ALTER TABLE table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;


, utf8_general_ci utf8_unicode_ci, , utf8_unicode_ci expansions, ( - ß = ss ). .. utf8_unicode_ci . , utf8_general_ci, .










, .
.
gedvix | 19 2010 22:04 | (0|0)
  • : |
  • : 1 ()

!

mak-shherbin | 25 2010 23:17 | (0|0)
  • : |
  • : 2 ()

! !


, , .