Ускорение сайта
lion2005
nginx-forum на nginx.us
Вс Июл 8 20:02:32 UTC 2012
Сайт: http://aszh-kzn.ru/
Хостинг: RU-CENTER, тариф 201 http://hosting.nic.ru/
Сервер: nginx 1.2.0 + Apache + php 5.2.10
Тестирование:
http://site-perf.com/cgi-bin/show.cgi?id=Y4z5tR_Bzzg
http://tools.pingdom.com/fpt/#!/M0MEZdKxh/aszh-kzn.ru/
nginx.conf.manual
-------------------------------------------------
##~#
worker_processes 1;
error_log /dev/null;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
}
http {
set_real_ip_from 10.1.0.0/16;
set_real_ip_from 10.3.0.0/16;
set_real_ip_from 10.12.0.0/16;
set_real_ip_from 195.208.0.0/23;
real_ip_header X-Real-IP;
include /usr/local/etc/nginx/mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
access_log off;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/vhosts_list.conf;
gzip on;
gzip_min_length 1100;
#gzip_buffers 64 8k;
gzip_comp_level 6;
gzip_http_version 1.0;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/xml
application/x-javascript text/javascript text/json;
gzip_vary on;
}
-------------------------------------------------
aszh-kzn.ru.vhost.conf
-------------------------------------------------
server {
listen 10.1.47.59:80;
server_name aszh-kzn.ru www.aszh-kzn.ru;
location / {
proxy_pass http://10.1.47.59:8080;
proxy_redirect http://aszh-kzn.ru:8080/ /;
proxy_redirect http://www.aszh-kzn.ru:8080/ /;
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 192m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 64k;
proxy_buffers 8 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
# 0
# Static files location
location ~*
^.+\.(jpg|jpeg|gif|swf|png|ico|mp3|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|dat|avi|ppt|txt|tar|mid|midi|wav|bmp|rtf|wmv|mpeg|mpg|mp4|m4a|spx|ogx|ogv|oga|webm|weba|ogg|tbz|js)$
{
root /home/sch20kzn/aszh-kzn.ru/docs/$subdomain;
expires max;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Cache-Control max-age=604800;
access_log /home/sch20kzn/aszh-kzn.ru/logs/access_log
combined;
error_page 404 = @fallback;
log_not_found off;
# 1
accel_htaccess_switch on;
set $subdomain "";
if ($host ~* ^([a-z0-9-\.]+)\.aszh-kzn.ru$) {
set $subdomain "subdmn/$1";
}
if ($host ~* ^www.aszh-kzn.ru$) {
set $subdomain "";
}
}
location @fallback {
proxy_pass http://10.1.47.59:8080;
expires max;
add_header Cache-Control max-age=604800;
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 192m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 64k;
proxy_buffers 8 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
# Error documents location
#location ^~ /errordocs {
# alias /home/sch20kzn/aszh-kzn.ru/errordocs;
#}
### rules if use subdmn in .htaccess ###
set $subdomain /home/sch20kzn/aszh-kzn.ru/docs;
if ($host ~* ^([\w-]+).aszh-kzn.ru$) {
set $subdomain "/home/sch20kzn/aszh-kzn.ru/docs/subdmn/$1";
}
if ($host ~* ^www.aszh-kzn.ru$) {
set $subdomain /home/sch20kzn/aszh-kzn.ru/docs;
}
# if directory "subdmn" exists - ok, change root
if ( -d "subdmn" ) {
set $root $subdomain;
}
}
-------------------------------------------------
Подскажите, пожалуйста, можно ли
ускорить загрузку сайта? Ускорить
загрузку статичных файлов: рисунки,
стили, скрипты и т.д.?
Posted at Nginx Forum: http://forum.nginx.org/read.php?21,228394,228394#msg-228394
Подробная информация о списке рассылки nginx-ru