linux-SYN-netstat TIME_WAIT

Linux Web服务器连接数控制

平时检测网站服务器连接数情况,常用的如  netstat -ant |awk ‘{print $6}’|sort|uniq -c |sort -n  给出如下统计

TIME_WAIT 3699 CLOSE_WAIT 52 FIN_WAIT1 32 SYN_SENT 1 FIN_WAIT2 2 ESTABLISHED 17 SYN_RECV 45 CLOSING 6

有时会发现大量的TIME_WAIT,SYN_RECV,  CLOSE_WAIT  ,  FIN_WAIT状态,此时需要对系统参数做些调整:

vi /etc/sysctl net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_keepalive_time = 1000 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_window_scaling = 0 net.ipv4.tcp_sack = 0 net.ipv4.tcp_max_syn_backlog = . . . → Read More: linux-SYN-netstat TIME_WAIT

fastcgi mod_fcgid: HTTP request length

最近在win2003 apache+php+fastcgi+mysql  开发环境下,使用wordpress上传图片时,遇到稍大的图片总是会遇到“HTTP error”,但是检查过php.ini发现文件大小限制post_max_size设置的没有问题,查看apache的logs 日志记录才显示了问题所在:

“mod_fcgid: HTTP request length 135567 (so far) exceeds MaxRequestLen (131072)”

原来是fastcgi模式下的设置问题,需要在配置文件.htaccess或者直接在apache的配置文件http.conf 中指明,如下:

<IfModule mod_fcgid.c>   AddHandler    fcgid-script .fcgi   FcgidConnectTimeout  20   # to get around upload errors when uploading images increase the MaxRequestLen size to 15MB   MaxRequestLen  15728640 </IfModule>

里面的“MaxRequestLen”就是fastcgi模式下上传文件也就是http接受的最大文件长度。

win2003 apache2.2.17 php5.3配置

Win2003 安装 apache 2.2.17 + php5.3.4 或5.3.6 +  Mysql 配置

Aapache安装

apache-2.2.17 下载地址 :http://httpd.apache.org/download.cgi   , http://www.apache.org/dist//httpd/binaries/win32/

版本选择httpd-2.2.17-win32-x86-no_ssl.msi (openssl多了个ssl安全认证模式,它的协议是HTTPS而不是HTTP,无特殊ssl连接需要下载no_ssl的版本即可)。

安装:一路next 下去 填写 network domain、server domain 一般填“localhost”即可,管理员邮箱随便填一个邮箱就可以(以后服务器出现问题,会提示联系管理员邮箱,方便处理问题。)

安装成功:一般安装结束时会请求是否开启apache服务,可以确定开启,自动打开Apache Service Monitor 同时在电脑右下角的任务栏里有一个绿色的apache服务器运行图标,显示为”>” 启动状态,此时可以本地打开浏览器输入http://localhost 或者 http://127.0.0.1 或者在其他机器上输入 该服务器ip到浏览器访问 http://xx.xx.xx.xx/  可以看到简单的测试页面 “It works” 说明apache已经成功运行。 Continue reading »win2003 apache2.2.17 php5.3配置

apache Could not reliably determine the server’s fully qualified domain name

“Could not reliably determine the server’s fully qualified domain name”

最近安装完apache,重启APACHE老出现httpd: Could not reliably determine the server’s fully qualified domain name

出现这个错误的原因是:ServerName 没有配置或配置错误的情况下用了系统IP做网站主机IP,而DNS未能配好,本机调试不需要配置DNS的情况下,可以将ServerName 改为localhost 本地环境,就不会请求DNS了

解决方案:

进入apache的安装目录,用记事本打开httpd.conf

将里面的#ServerName www.example.com:80注释去掉即可,,并改成ServerName 127.0.0.1:80。或者 ServerName localhost:80 (80是端口,只要不冲突可以改为其他端口,一般80为默认端口)

再执行httpd

重启APACHE后就不会出现那个提示了.