Nginx无法上传文件或者time out的解决办法

nginx上传附件都失败,并且页面偶尔提示timeout或者413 Request Entity Too Large
错误日志为:

  1. [error] 24225#0: *44 client intended to send too large body: 3005474 bytes, client: x.x.x.x, server: _, request: "POST /phpmyadmin/import.php HTTP/1.1", host: "baiqiuyi.com", referrer: "http://baiqiuyi.com/xxxxxxxxxxxxxxxxxx
  1. 打开nginx.conf并在http{}字段里添加
  2. client_max_body_size 64M; #多少M根据实际情况填写
  3. # keepalive_timeout 的值最好也修改一下,否则phpmyadmin上传的时候很容易time out


asp实现301重定向

不带www的域名,301重定向到带www的域名
以我博客的域名为例:

  1. <%
  2. if request.ServerVariables("SERVER_NAME")="baiqiuyi.com" then 
  3. Response.Status="301 Moved Permanently" 
  4. Response.AddHeader "Location", "http://www.baiqiuyi.com"
  5. Response.End
  6. end if
  7. %>

所有绑定的域名,都会301重定向

  1. <%@ Language=VBScript %>
  2. <%
  3. Response.Status="301 Moved Permanently"
  4. Response.AddHeader "Location","http://www.baiqiuyi.com/"
  5. %>

Directadmin安装Zend Optimizer与Ioncube

  1. [root@localhost ~]# /usr/local/directadmin/custombuild/build set zend yes
  2. [root@localhost ~]# ./build zend
  3.  
  4. [root@localhost ~]# /usr/local/directadmin/custombuild/build set ioncube yes
  5. [root@localhost ~]# ./build ioncube

或者编辑Directadmin的options.conf,重新编译一次

  1. 打开options.conf文件
  2. [root@localhost ~]# vi /usr/local/directadmin/custombuild/options.conf
  3. #找到
  4. ioncube=No
  5. zend=No
  6. #改为
  7. ioncube=yes
  8. zend=yes
  9. [root@localhost ~]# /usr/local/directadmin/custombuild/build all

Centos yum开启repo

  1. yum --enablerepo=epel
  2. Error getting repository data for epel, repository not found
  3.  
  4. rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  5. Retrieving http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  6. warning: /var/tmp/rpm-xfer.YIVKhh: Header V3 DSA signature: NOKEY, key ID 217521f6
  7. Preparing...                ########################################### [100%]
  8.    1:epel-release           ########################################### [100%]

update 2014-8-11

  1. #64位 Centos7.x
  2. rpm -Uvh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

update:

  1. #32位 Centos5.x
  2. [root@localhost ~]#  rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 
  3. Retrieving http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  4. warning: /var/tmp/rpm-xfer.yXjRRn: Header V3 DSA signature: NOKEY, key ID 217521f6
  5. Preparing...                ########################################### [100%]
  6.    1:epel-release           ########################################### [100%]
  7.  
  8. #64位
  9. [root@localhost ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  10. Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  11. warning: /var/tmp/rpm-tmp.3lY8ZZ: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
  12. Preparing...                ########################################### [100%]
  13.    1:epel-release           ########################################### [100%]
  1. #2013年8月27 更新
  2. #RPMForget 32位 Centos5.x
  3. rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.i386.rpm
  4. #
  5. #RPMForget 64位 Centos5.x
  6. rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
  7. #
  8. #RPMForget 32位 Centos6.x
  9. rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
  10. #
  11. #RPMForget 64位 Centos6.x
  12. rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

centos安装mod_rpaf

centos安装mod_rpaf

第三方的apache模块,用以支持apache在后端正确的显示IP头信息 前端类似Nginx Varnish等

  1. yum install httpd-devel gcc
  2.  
  3. wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
  4. tar xzvf mod_rpaf-0.6.tar.gz
  5. cd mod_rpaf-0.6
  6. apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
  7.  
  8.  
  9.  
  10. vi /etc/httpd/conf/httpd.conf
  11.  
  12. ## Begin Rpaf_mod
  13. LoadModule rpaf_module /usr/lib/apache/mod_rpaf-2.0.so
  14. RPAFenable On
  15. RPAFsethostname On
  16. RPAFproxy_ips Your_cache_IP
  17. RPAFheader X-Forwarded-For
  18. ## End Rpaf_mod
  19.  
  20.  
  21. service httpd restart

下载链接失效可用地址: http://mirror.trouble-free.net/sources/mod_rpaf-0.6.tar.gz

1 1