05 2012 档案
摘要:Nginx可以通过HTTPLimitZoneModule和HTTPCoreModule两个目录来限速。示例:1 limit_zone one $binary_remote_addr 10m;2 3 location / { 4 5 limit_conn one 1;6 7 limit_rate 100k;8 9 } 说明:limit_zone,是针对每个IP定义一个存储session状态的容器。这个示例中定义了一个10m的容器,按照32bytes/session,可以处理320000个session。然后针对目录进行设定。limit_connone1;...
阅读全文
摘要:1、查看当前的PHP FastCGI进程数是否够用:netstat -anpo | grep “php-cgi” | wc -l 如果实际使用的”FastCGI进程数”接近预设的”FastCGI进程数”,那么,说明”FastCGI进程数”不够用,需要增大。2、部分PHP程序的执行时间超过了Nginx的等待时间,可以适当增加nginx.conf配置文件中FastCGI的timeout时间,例如:……http{……fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300;……}
阅读全文
摘要:要使用Nginx下的泛域名支持,必须在编译 Nginx的时候加上–with-http_sub_module在配置nginx时:server_name www.domain.com *.domain.com;然后启动nginx就可以实现了[nginx -s reload]
阅读全文
摘要:Nginx的日志记录主机设置server {listen 80;server_name a8z8.com;root /etc/www/abc;access_log /var/log/www/abc/access.log;location / {index index.htm index.htm;}}默认情况下,access_log 会使用 combined 的配置来记录访问日志log_format combined ‘$remote_addr – $remote_user [$time_local] ‘‘”$request” $status $body_bytes_sent ‘‘”$http_
阅读全文
摘要:1:Function ereg() is deprecated Error 错误对策 Deprecated: Function ereg() is deprecated in …… 解决方法一: 退回去用php5.2。 解决方法二:继续用php5.3,但是修改devel/devel.modul的460行: if ($errno & (E_ALL ^ E_NOTICE)) { 改为 if ($errno & (E_ALL & ~E_NOTICE & ~E_DEPRECATED)) { 把deprecated错误给忽略掉) 解决方法三:把ereg换成preg_mat
阅读全文
摘要:1 netstat -n | awk '/^tcp/ {n=split($(NF-1),array,":");if(n<=2)++S[array[(1)]];else++S[array[(4)]];++s[$NF];++N} END {for(a in S){printf("%-20s %s\n", a, S[a]);++I}printf("%-20s %s\n","TOTAL_IP",I);for(a in s) printf("%-20s %s\n", a, s[a]);pri
阅读全文
摘要:1 server { 2 include listen.conf; 3 server_name ucenter.gznow.org; 4 5 location ~ \.php$ { 6 limit_conn one 20; 7 limit_rate 50k; 8 proxy_pass http://s1; 9 include proxy.conf;10 }11 12 location / {13 expires max;14 ...
阅读全文
摘要:Nginx中Upstream目前支持4种方式的分配1、轮询(默认)每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。2、weight指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。 例如: upstream bakend { server 192.168.0.14 weight=10; server 192.168.0.15 weight=10; }3、ip_hash 每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题。例如:1 upst...
阅读全文
摘要:1、传统缓存之一(404)这个办法是把nginx的404错误定向到后端,然后用proxy_store把后端返回的页面保存。配置:location / {root /home/html/;#主目录expires 1d;#网页的过期时间error_page 404 =200 /fetch$request_uri;#404定向到/fetch目录下}location /fetch/ {#404定向到这里internal;#指明这个目录不能在外部直接访问到expires 1d;#网页的过期时间alias /home/html/;#虚拟目录文件系统地址要和locaion /一致,proxy_store会将
阅读全文
摘要:1.FastCGIworker进程数是否不够通过命令查看服务器上一共开了多少的php-cgi进程ps-fe|grep"php"|grep-v"grep"|wc-l 使用如下命令查看已经有多少个php-cgi进程用来处理tcp请求netstat-anop|grep"php"|grep-v"grep"|wc-l 接近配置文件中设置的数值,表明worker进程数设置太少2.FastCGI执行时间过长根据实际情况调高以下参数值fastcgi_connect_timeout300;fastcgi_send_timeout30
阅读全文
摘要:VC6:legacy Visual Studio 6 compiler,就是使用这个编译器编译的。VC9:Visual Studio 2008 compiler,就是用微软的VS编辑器编译的。由于apache.org只提供VC6的版本,所以使用原版apache时只能使用VC6。(www.apachelounge.com上有apache VC9的版本提供,应该可以和PHP VC9配合,没用过)TS:...
阅读全文
摘要:Notice: Undefined index: xxx on line xxx; 虽然可以通过设置错误显示方式来隐藏这个提示,但是这样也有隐患,就是在服务器的日志中会记录这些提示,导致日志文件异常庞大。 方法1:服务器配置修改修改php.ini配置文件,error_reporting = E_ALL & ~E_NOTICE 方法2:对变量进行初始化。 方法3:做判断isset($_post[''...
阅读全文
摘要:以前每当一个 Zend Studio 的新版本发布时都会同时发布一个新版的 Zend Studio Server 组件,这个组件可以让我们很方便地进行远程调试。但是自从 Zend 发布了 Zend Platform 以后他们就不再更新 Zend Studio Server 组件了。这就导致我们只能远程调试 PHP 5.1.x 的环境,而不能调试 PHP 5.2.x。要想调试 PHP 5.2.x 只...
阅读全文
摘要:[PHP] ;;;;;;;;;;;;;;;;;;; ; About php.ini ; ;;;;;;;;;;;;;;;;;;; ; This file controls many aspects of PHP's behavior. In order for PHP to ; read it, it must be named 'php.ini'. PHP looks for it i...
阅读全文

浙公网安备 33010602011771号