gjw_apparitor 博客
孤独是一种态度
孤独是一种态度
四 6th
在apache的 httpd.conf中
去消掉前边的注释
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddHandler server-parsed .shtml .html
Options Indexes FollowSymLinks Includes
AllowOverride None
Order allow,deny
Allow from all
在Directory里添加 Options Indexes FollowSymLinks Includes
四 6th
prce
http://www.pcre.org/
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.9.tar.gz # tar zxvf pcre-7.9.tar.gz # cd pcre-7.9 # ./configure # make && make install
zlib
http://www.zlib.net/
# wget http://www.gzip.org/zlib/zlib-1.2.3.tar.gz # tar zxvf zlib-1.2.3.tar.gz # cd zlib-1.2.3 # ./configure # make && make install # mkdir /usr/include/pcre/ # cp /usr/local/lib/libpcre.a /usr/include/pcre/libpcre.a # cp /usr/local/lib/libpcre.a /usr/include/pcre/libpcre.la # cp /root/pcre-7.9/pcre.h /usr/include/pcre/pcre.h # mkdir /usr/include/pcre/.libs # cp /usr/local/lib/libpcre.a /usr/include/pcre/.libs/libpcre.a # cp /usr/local/lib/libpcre.a /usr/include/pcre/.libs/libpcre.la # cp /root/pcre-7.9/pcre.h /usr/include/pcre/.libs/pcre.h
Nginx
http://nginx.net/
# http://sysoev.ru/nginx/nginx-0.7.62.tar.gz # tar zxvf nginx-0.7.62.tar.gz # cd /nginx-0.7.62 #./configure --prefix=/data_web/nginx-0.7.62/ \ --with-http_stub_status_module \ --with-http_gzip_static_module vi objs/Makefile 删除“./configure –disable-shared”行 # make && make install
四 6th
ServerLimit 50 apache 进程数上限
ThreadLimit 110 apache 线程数上限
StartServers 5 apache 启动时默认建立的进程数
MaxClients 5000 最大并发数
MinSpareThreads 25 最小线程空闲数
MaxSpareThreads 200 最大线程空闲数
ThreadsPerChild 100 每个进程最多开启的线程
MaxRequestsPerChild 5000 指令用于控制服务器建立新进程和结束旧进程的频率
MaxRequestsPerChild 等于 MaxSpareThreads 或者 等于0 没有限制 最好不要设置为0防止内存溢出把服务拖死。
ServerLimit 大于 MaxClients/ThreadsPerChild
ThreadLimit 大于 MaxClients/ServerLimit
MaxSpareThreads 大于 ThreadsPerChild
四 6th
如果你的页面里SSI文件是用 “include virtual=”着种方式嵌套进去的。
你又配置了,错误页面跳转。
error_page 404 404.html
当你嵌套的页面不存在的时候就会发生整个页面变成404跳到404.html下了。
我们着一个技术很牛的同事想到的。
解决:
再域名的根目录创建个文本文件,里边的内容随意。我的是:
echo ‘‘ > ssi_404.txt
再nginx的配置文件里加上:
location ~* \.shtml$ {
error_page 404 ssi_404.txt;
}
这样有404的ssi页面就会显示这个内容,从而不会跳到404.html去了。
四 6th
我的Discuz 论坛 的apache+php 换成了nginx+fastcgi , 最近一到访问量高峰的时候就会出现:
504 Gateway Time-out
调整nginx配置文件如下:
# vi nginx.conf
fastcgi_buffers 8 128K;
send_timeout 60;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
四 6th
简介:
url_hash 是nginx的第三方模块,nginx本身不支持,需要打patch .
Url_hash 你nginx在做负载均衡的时候。把转发的URL 以hash的形式保存。这样可以保证同一个URL始终
分给同一个real server,来提高访问速度。
为了确保能在 Nginx 中使用正则表达式进行更灵活的配置,安装之前需要确定系统是否安装有 PCRE(Perl Compatible Regular Expressions)包。您可以到 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:
软件列表:
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.7.tar.gz
wget http://sysoev.ru/nginx/nginx-0.7.57.tar.gz
wget http://wiki.nginx.org/images/7/78/Nginx_upstream_hash-0.3.tar.gz