1,先安装php环境:
http://www.cnblogs.com/zxpo/p/3798983.html
按文件操作,还需进行如下修改:
cd /usr/local/php/etc/php-fpm.d
cp www.conf.default www.conf
如启动错误,参考:
http://blog.csdn.net/loveaborn/article/details/20296411
http://www.111cn.net/sys/linux/75704.htm (/usr/sbin/php-fpm -R 这步关键)
安装:
http://laoxu.blog.51cto.com/4120547/1159491/ //推荐
http://www.linuxde.net/2012/04/9537.html //辅助,不是很详尽
nginx-rrd-0.1.4.tgz下载地址 http://linuxsogood.org/542.html
nginx配置文件如报错可添加如下设置:
location ~ ^/(connections|requests|restart) {
root html;
index index.html index.htm;
}
- tar xzvf nginx-1.2.0.tar.gz
- cd nginx-1.2.0
- ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
- make && make install
- yum install perl rrdtool perl-libwww-perl libwww-perl perl-rrdtool
确定
rrdtool 和相应的perl 被安装上后,开始安装nginx-rrd
- tar zxvf nginx-rrd-0.1.4.tgz
- cd nginx-rrd-0.1.4
- cp -p usr/sbin/* /usr/sbin //复制主程序文件到 /usr/sbin 下
- cp -p etc/nginx-rrd.conf /etc //复制配置文件到 /etc 下
- 创建nginx-rrd生成目录
- mkdir /usr/local/nginx/html/rrd
- cp html/index.php /usr/local/nginx/html
这里提醒需要修改
index.php文件的默认访问密码WCO。
- vim /etc/nginx-rrd.conf
- #####################################################
- #
- # dir where rrd databases are stored
- RRD_DIR="/usr/local/nginx/html/rrd";
- # dir where png images are presented
- WWW_DIR="/usr/local/nginx/html";
- # process nice level
- NICE_LEVEL="-19";
- # bin dir
- BIN_DIR="/usr/sbin";
- # servers to test
- # server_utl;server_name
- SERVERS_URL="http://www.linuxom.com/nginx_status;www.linuxom.com"
- /usr/local/nginx/sbin/nginx -V
- nginx version: Nginx/1.2.0
- configure arguments: --with-http_stub_status_module
- vim /usr/local/nginx/conf/nginx.conf
- //server{} 中,需要已经加入如下内容
- location / {
- root html;
- index index.php index.html index.htm;
- location /nginx_status {
- stub_status on; //这个选项参数就是在编译时对stub_status模块的支持,如果不编译加入则会在启动nginx时有警告信息
- access_log off;
- }
- }
- #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 html;
- }
- # 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
- #
- // 去掉如下内容的注释,这里是对php的支持,注意文件路径
- location ~ \.php$ {
- root html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
- include fastcgi_params;
- }
- /usr/local/nginx/sbin/nginx -s reload
- crontab -e
- * * * * * root /usr/sbin/nginx-collect
- */10 * * * * root /usr/sbin/nginx-graph
访问页面
http://域名/index.php,nginx的连接数如下图