Drupal 系列二:常见问题汇总 给大家汇总了常见的问题与模块,但模块多了,网站就开始很慢了,下面就解决网站速度的问题:
最基本的设置:在 配置-> 开发 ->性能 里面,把缓存与压缩打开:

用nginx + php-fpm 做后端(官方推荐用nginx):
nginx 的安装就不说了,网上很多。(我用的是Tengine ,淘宝优化过的Nginx,可看我的博客)
下面列出nginx的配置文件:(重要)
编辑 /etc/nginx/conf.d/default.conf,以本站为例,配置文件如下:
server {
listen 80;
server_name imysql.com *.imysql.com;
root /data/www/imysql.cn/;
index index.php index.htm index.html index.shtml;
error_page 404 /page_not_found;
error_page 500 502 503 504 /page_not_found;
location ~ /\.ht {
deny all;
}
if ($fastcgi_script_name ~ \..*\/.*php) {
return 403;
}
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1h;
}
location ^~ /sites/default/files/imagecache/ {
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last; break;
}
}
}3.关掉不常用的模块
4.禁用不常用的视图(视图很占速度)
