Archive

Archive for December 31st, 2008

google PR更新了 本博从0至3

December 31st, 2008

google PR历时快半年了,终于更新了。不过还没有预想中的好。
预想中的应该是4。哈哈,也可能有点一厢情愿。
中间还历经了两次301转向。

不过3也还凑和了。再接再励嘛。
到3了,再到4,到5也就不难了。

后来看了看新闻才知道,这次更新很多网站PR都降了。不过我的网站PR都没有降。这个博客从0升到3。以前的PR4的和PR5的也都没有降,不过,也没有升。

欢迎其它博客来链接啊。一起发展嘛。

Uncategorized

PHP FastCGI 进程管理器: PHP-FPM [DBA notes]

December 31st, 2008

最近 PHP-FPM (PHP FastCGI Process Manager) 这个话题在讨论组里很受关注。使用 PHP 的朋友对于 FastCGI 进程的管理估计都很头疼,比如 Nginx 下的 FastCGI 就有不少人用的 Lighttpd 的 spawn-fcgi 来对进程进行管理。但这样存在不少缺点(中文版本)。

PHP-FPM 配置起来很简单,但有一点比较有意思的是如何确定 Worker 的数量。PHP-FPM 作者 Andrei Nigmatulin 在新闻组里提到的小技巧如下:

1) 用 Linux top 命令观察 (这个方式比较土)
2) 用 ‘netstat -np | grep 127.0.0.1:9000′ 收集数据。
设置 php-fpm.conf 中的 max_children 的数值使 等待的数量变为最小。

目前使用 PHP-FPM 还只是通过 Patch 方式,然后编译,期待能够早点并入正式的 PHP 代码中。

apache, linux ,

Ubuntu环境搭建nginx+php系统

December 31st, 2008

1,安装nginx,执行以下命令,很快完成,不过目前apg-get方式安装默认是0.5.33的版本

sudo apt-get install nginx

配置文件默认安装位置:

  conf: /etc/nginx/nginx.conf

  bin:/usr/sbin/nginx

  vhost: /etc/nginx/sites-enable/default

  cgi-params: /etc/nginx/fastcgi-params

  建一个虚拟Server

  server {

  listen 80;

  server_name www.23day.com;

  access_log /var/log/nginx/home.ucenter.access.log;

  location / {

  root /var/www/23day.com;

  index index.php;

  location ~ \.php$ {

  fastcgi_pass 127.0.0.1:9000;

  fastcgi_index index.php;

  fastcgi_param SCRIPT_FILENAME /var/www/23day.com$fastcgi_script_name;

  include /etc/nginx/fastcgi_params;

  }

  }

  2,安装php-cgi模块执行sudo apt-get install php5-cgi 配置文件默认安装位置:

  php-cgi: /usr/bin/php-cgi

  php5-cgi: /usr/bin/php5-cgi

  cgi config: /usr/bin/cgi/php.ini [/quote]

修改php.ini文件的cgi.fix_pathinfo数据为1,默认为0 cgi.fix_pathinfo=1; 这样php-cgi方能正常使用SCRIPT_FILENAME这个变量.

  3,安装spawn-fcgi spawn-fcgi是lighttpd的一个用来控制php-cgi的工具.

如果系统没有安装GCC编译环境,刚需要在安装lighttpd之前要安装build-essential工具包,执行以下命令

  sudo apt-get install build-essential

  wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz

  tar -xvf lighttpd-1.4.19.tar.gz

  cd lighttpd-1.4.19/

  sudo apt-get install libpcre3-dev

  ./configure –without-zlib –without-bzip2

  make

  sudo cp src/spawn-fcgi /usr/local/bin/spawn-fcgi

这样cgi控制器就安装完成.

  4.启动测试系统.启动fast_cgi:

  spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -u www-data -g www-data -f /usr/bin/php-cgi

  注意:ip,端口与nginx服务器中的cgi-pass要对应. -C表示打开几个cgi进程

  启动nginx

  sudo /etc/init.d/nginx start

  好了,如果没有出错信息,则说明配置成功了,现在写个phpinfo测试下吧!

  最后,附上我的/etc/nginx/sites-enable/default的配置文件,此配置文件启用了rewrite功能

  server {

  listen 80;

  server_name localhost;

  access_log /var/log/nginx/localhost.access.log;

  location / {

  root /var/www/nginx-default;

  index index.php;

  if (-f $request_filename/index.html){

  rewrite (.*) $1/index.html break;

  }

  if (-f $request_filename/index.php){

  rewrite (.*) $1/index.php;

  }

  if (!-f $request_filename){

  rewrite (.*) /index.php;

  }

  }

  #error_page 404 /404.html;

  # redirect server error pages to the static page /50x.html

  #

  error_page 500 502 503 504 /50x.html;

  location = /50x.html {

  root /var/www/nginx-default;

  }

  # proxy the PHP scripts to Apache listening on 127.0.0.1:80

  #

  #location ~ \.php$ {

  #proxy_pass http://127.0.0.1;

  #}

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

  #

  location ~ \.php$ {

  fastcgi_pass 127.0.0.1:9000;

  fastcgi_index index.php;

  fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;

  include /etc/nginx/fastcgi_params;

  }

  # deny access to .htaccess files, if Apache’s document root

  # concurs with nginx’s one

  #

  #location ~ /\.ht {

  #deny all;

  #}

  }

  # another virtual host using mix of IP-, name-, and port-based configuration

  #

  #server {

  #listen 8000;

  #listen somename:8080;

  #server_name somename alias another.alias;

  #location / {

  #root html;

  #index index.html index.htm;

  #}

  #}

  # HTTPS server

  #

  #server {

  #listen 443;

  #server_name localhost;

  #ssl on;

  #ssl_certificate cert.pem;

  #ssl_certificate_key cert.key;

  #ssl_session_timeout 5m;

  #ssl_protocols SSLv2 SSLv3 TLSv1;

  #ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

  #ssl_prefer_server_ciphers on;

  #location / {

  #root html;

  #index index.html index.htm;

  #}

  #}

linux , ,

Firefox插件DownthemAll在linux下还是挺好用的

December 31st, 2008

在windows下迅雷无疑是非常好的下载工具。

在ubuntu下,默认只装了个BT。没有多线程的断点续传的下载工具。

在装firefox插件的时候,把DownthemAll装上了。没想到还挺好用。

这下都不用专门的去装下载工具了。以前在windows下装过一回,不过几乎是没用过。这回在ubuntu下用用发现还是蛮不错的。速度也很快。我这1M的adsl已经跑到头了,一百五六十K。

downthemall

Uncategorized