各种程序的伪静态规则

顾名思义, 伪静态是相对真实静态来讲的. 通常我们为了更好的缓解服务器压力,和增强搜索引擎的友好面.都将文章内容生成静态页面. 但是有的朋友为了实时的显示一些信息.或者还想运用动态脚本解决一些问题.不能用静态的方式来展示网站内容. 但是这就损失了对搜索引擎的友好面.怎么样在两者之间找个中间方法呢,这就产生了伪静态技术. 就是展示出来的是以.html一类的静态页面形式,但其实是用ASP一类的动态脚本来处理的. 我的一个思路是用IIS的404错误处理机制来实现的.这个比rewrite技术要灵活得多. 首先,设置站点属性-自定意错误 找到HTTP错误404,然后编辑属性->消息类型选中URL->URL填入“/index.asp”,或您的错误处理页面. 这样,比如用户或蜘蛛访问http://tech.todo.net.cn/12345.html 时(12345为文章在数据库的ID).由于些页面不存在,所以触发了404错误.转向了index.asp 在index.asp里加 CurrDomain=Request.ServerVariables(“HTTP_HOST”) ‘当前访问域名 CurrURL=Replace(Request.ServerVariables(“QUERY_STRING”),“404;http://"&CurrDomain&":80”,"") ‘当前访问URL 此时的CurrURL应该是:12345.html . 这样,就得到用户正在试图访问的页面.然后提取里边的文章ID(应该为:12345),用正则,这里就不多说了. 然后到数据库里提取出文章内容.输出到页面里,就OK了. 这样.用户或蜘蛛看到的URL还是他访问的URL.而我们对内容的处理上可以用到了动态技术.这就是我们想要的结果. 说得简单了一些.但是基本思路就是这样了. [编辑本段]伪静态的利与弊 当然犹如一篇文章的作者所说的:“如果流量稍大一些使用伪静态就出现CPU使用超负荷,我的同时在线300多人就挂了,而不使用伪静态的时候同时在线超500人都不挂,我的ISS数是1000。” 确实是这样的,由于伪静态是用正则判断而不是真实地址,分辨到底显示哪个页面的责任也由直接指定转由CPU来判断了,所以CPU占有量的上升,确实是伪静态最大的弊病。 我们应该选择伪静态还是真静态? 1、使用真静态和假静态对SEO来说没有什么区别 2、使用真静态可能将导致硬盘损坏并将影响论坛性能 3、使用伪静态将占用一定量的CPU占有率,大量使用将导致CPU超负荷 4、最重要的一点,我们要静态是为了SEO 所以: 1、使用真静态的方法可以直接排除了,因为无论怎么生成,对硬盘来说都是很伤的。 2、既然真伪静态的效果一样,我们就可以选择伪静态了。 3、但是伪静态大量使用会照成CPU超负荷。 4、所以我们只要不大量使用就可以了。 5、既然静态只是给SEO看的,我们只需要伪静态给SEO就行了,不需要给用户使用。 6、所以我们只要在专门提供给SEO爬的Archiver中使用伪静态就可以了。 7、谢谢大家耐心看我写的文章。 8、有何不解的地方或是有不同的看法欢迎提出。 关于伪静态和真静态的评论 真正的静态化和伪静态还是有本质的区别的。为浏览用户处理一个纯粹htm和一个调用多个数据的php在CPU的使用率方面明显前者少。记得原来有个人说html下载硬盘读写频繁,他这么说好像读取数据库不用读写磁盘似的,何况还有一大堆缓存的零散php也是放在硬盘的,这些读取不用磁盘操作么?可笑。 读取单个htm+图片Flash等附件就可以实现的目的,何苦要读数据库又要读php缓存文件又要重新整合数据输出再+图片Flash等附件这么大费周章呢?CMS首页不需要很多的互动的,论坛那一套不应该拿到这里来用,相反应该更多考虑的是:美观!兼容!信息的直观!性能!还有稳定! 各种程序的伪静态规则

2009-04-01 · 1 min · 43 words · admin

SSH、PUTTY远程LINUX 乱码

vi /etc/sysconfig/i18n 将内容改为 LANG=“zh_CN.GB18030” LANGUAGE=“zh_CN.GB18030:zh_CN.GB2312:zh_CN” SUPPORTED=“zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en” SYSFONT=“lat0-sun16” 这样中文在SSH,telnet终端就可以正常显示了。 或者改成下面的,正常显示英文。 LANG=“en_US.UTF-8” SUPPORTED=“en_US.UTF-8:en_US:en” SYSFONT=“latarcyrheb-sun16

2009-04-01 · 1 min · 12 words · admin

linux对应PPPOE的sh脚本

#!/bin/bash # 请先输入您的相关参数,不要输入错误了! EXTIF=“ppp0” # 这个是可以连上 Public IP 的网路介面 INIF=“eth0” # 内部 LAN 的连接介面;若无请填 "" INNET=“10.0.0.0/8” # 内部 LAN 的网域,若没有内部 LAN 请设定为 "" export EXTIF INIF INNET # 第一部份,针对本机的防火墙设定!########################### # 1. 先设定好核心的网路功能: echo “1” > /proc/sys/net/ipv4/tcp_syncookies echo “1” > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts for i in /proc/sys/net/ipv4/conf/*/rp_filter; do echo “1” > $i done for i in /proc/sys/net/ipv4/conf/*/log_martians; do echo “1” > $i done for i in /proc/sys/net/ipv4/conf/*/accept_source_route; do echo “0” > $i done for i in /proc/sys/net/ipv4/conf/*/accept_redirects; do echo “0” > $i done for i in /proc/sys/net/ipv4/conf/*/send_redirects; do echo “0” > $i done # 2. 清除规则、设定预设政策及开放 lo 与相关的设定值 PATH=/sbin:/usr/sbin:/bin:/usr/bin; export PATH iptables -F iptables -X iptables -Z iptables -P INPUT Drop iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -m state –state RELATED -j ACCEPT # 3. 启动额外的防火墙 script 模组 if [ -f /usr/local/virus/iptables/iptables.deny ]; then sh /usr/local/virus/iptables/iptables.deny fi if [ -f /usr/local/virus/iptables/iptables.allow ]; then sh /usr/local/virus/iptables/iptables.allow fi if [ -f /usr/local/virus/httpd-err/iptables.http ]; then sh /usr/local/virus/httpd-err/iptables.http fi iptables -A INPUT -m state –state ESTABLISHED -j ACCEPT # 4. 允许某些类型的 ICMP 封包进入 AICMP=“0 3 3/4 4 11 12 14 16 18” for tyicmp in $AICMP do iptables -A INPUT -i $EXTIF -p icmp –icmp-type $tyicmp -j ACCEPT done # 5. 允许某些服务的进入,请依照您自己的环境开启 # iptables -A INPUT -p TCP -i $EXTIF –dport 22 -j ACCEPT # SSH # iptables -A INPUT -p TCP -i $EXTIF –dport 25 -j ACCEPT # SMTP # iptables -A INPUT -p UDP -i $EXTIF –sport 53 -j ACCEPT # DNS # iptables -A INPUT -p TCP -i $EXTIF –sport 53 -j ACCEPT # DNS # iptables -A INPUT -p TCP -i $EXTIF –dport 80 -j ACCEPT # WWW # iptables -A INPUT -p TCP -i $EXTIF –dport 110 -j ACCEPT # POP3 # iptables -A INPUT -p TCP -i $EXTIF –dport 443 -j ACCEPT # HTTPS # 第二部份,针对后端主机的防火墙设定!############################## # 1. 先载入一些有用的模组 modules=“ip_tables iptable_nat ip_nat_ftp ip_nat_irc ip_conntrack ip_conntrack_ftp ip_conntrack_irc” for mod in $modules do testmod=`lsmod | grep “${mod} “` if [ “$testmod” == "” ]; then modprobe $mod fi done # 2. 清除 NAT table 的规则吧! iptables -F -t nat iptables -X -t nat iptables -Z -t nat iptables -t nat -P PREROUTING ACCEPT iptables -t nat -P POSTROUTING ACCEPT iptables -t nat -P OUTPUT ACCEPT # 3. 开放成为路由器,且为 IP 分享器! if [ “$INIF” != "” ]; then /sbin/iptables -A INPUT -i $INIF -j ACCEPT echo “1” > /proc/sys/net/ipv4/ip_forward /sbin/iptables -t nat -A POSTROUTING -s $INNET -o $EXTIF -j MASQUERADE fi # 如果你的 MSN 一直无法连线,或者是某些网站 OK 某些网站不 OK, # 可能是 MTU 的问题,那你可以将底下这一行给他取消注解来启动 MTU 限制范围 # iptables -A FORWARD -p tcp -m tcp –tcp-flags SYN,RST SYN -m tcpmss \ # –mss 1400:1536 -j TCPMSS –clamp-mss-to-pmtu # 4. 内部伺服器的设定: # iptables -t nat -A PREROUTING -p tcp -i $EXTIF –dport 80 \ # -j DNAT –to 192.168.1.210:80 # Deny All Other Connections /sbin/iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT

2009-04-01 · 3 min · 477 words · admin

mysql集群配置

Mysql Cluster: The definitive HOWTO This guide was written over a year ago and is an excellent introduction however it has not been updated since! If you have any questions please email me or Buy my book (US). Introduction You MUST have a third server as a managment node but this can be shut down after the cluster starts. Also note that I do not recommend shutting down the managment server (see the extra notes at the bottom of this document for more information). You can not run a mysql cluster with just two servers And have true redundancy. ...

2009-04-01 · 12 min · 2361 words · admin

在CentOS 5上架设PPTP Server

用Poptop建立基于Linux的PPTP Server,可以让漫游用户从Internet上的任何地方安全地连接到公司内部网络。支持Windows 95/98/Me/NT/2000/XP和Linux上的PPTP客户端。要求:CentOS 5 kernel-2.6.18-8.el5 ppp-2.4.4-1.el5 Kernel version 2.6.15及以上版本内核内置了MPPE的支持,CentOS 5的kernel是2.6.18,所以不需要再安装MPPE模块。 CentOS 5自带的ppp-2.4.4-1.el5也支持MPPE。 1.运行下面的命令测试内核是否支持MPPE如果支持会返回“ok”:modprobe ppp-compress-18 && echo ok 2. 从下面的网址下载RPM文件pptpd-1.3.4-1.rhel5.1.i386.rpm : -http://poptop.sourceforge.net/yum/stable/packages/ 3. 安装RPM文件: -rpm -ivh pptpd-1.3.4-1.rhel5.1.i386.rpm4. 修改文件/etc/ppp/options.pptpd如下: -name pptpd refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe-128 proxyarp lock nobsdcomp novj novjccomp nologfd 5. 修改文件/etc/pptpd.conf如下: -option /etc/ppp/options.pptpd logwtmp localip 192.168.2.1 remoteip 192.168.2.11-156. 在/etc/ppp/chap-secrets 里添加下面的帐号(johndie)和密码(passwrd) : # Secrets for authentication using CHAP # client server secret IP addresses “user” pptpd “passwd” “ip”(*表示可以多人连接)

2009-03-31 · 1 min · 68 words · admin

在Linux操作系统下配置多线路ADSL的方法

此文档可以说明双ADSL及多ADSL增加线路的配置过程。 Linux配置多线路ADSL的方法 powered by KindGeorge http://kindgeorge.at.3322.org\经过一段时间的观察,证明运行良好,现把设置过程及方法总结一下,欢迎指正. 此文档可以说明双adsl及多adsl增加线路的配置过程. 实验环境: 操作系统: RedHat7.3 两条adsl,长期观察线路稳定,动态ip,带宽2M, 三块网卡: eth0 tulip,接内网 eth1 3c59x,接第一条adsl eth2 8139too,接第二条adsl ethn xxxx,(如果还有的话….) 目的:用两条adsl共同上网,分担负载,实现一般的简单负载平衡,带动内网上网. 1.添加网卡 插入网卡,启动机器,如果需要双线路上网,就要三块网卡了,配置网卡也可以参考其他资料. 配置为找到相应的型号模块,例如:eth2是8139的网卡 [root@kindgeorge root]# vi /etc/modules.conf alias parport_lowlevel parport_pc alias eth0 tulip alias eth1 3c59x alias eth2 8139too 把新的线路插在eth2上 2.配置adsl 方法一: (1)运行adsl-setup程序,会一步一步的提示你完成配置过程. 创建ppp0和ppp1的拨号配置文件,并保存配置,一般保存在/etc/sysconfig/network-scripts/ifcfg-ppp1 (2)确定/etc/sysconfig/network-scripts/ifcfg-ppp0文件,其中的PIDFILE参数设为: PIDFILE=/var/run/ppp-adsl.pid 修改/etc/sysconfig/network-scripts/ifcfg-ppp1文件,将其中的PIDFILE参数设为: PIDFILE=/var/run/ppp-adsl1.pid 如果你有更多的线路,可以继续增加0,1,2,3….等 这是为了使不同的拨好用不同的pid,如果不修改此参数将无法启动第二条线路接口。 (3)配置文件一般是: USERCTL=no BOOTPROTO=dialup NAME=DSLppp1 DEVICE=ppp1 TYPE=xDSL ONBOOT=yes PIDFILE=/var/run/pppoe-adsl1.pid FIREWALL=NONE PING=. PPPOE_TIMEOUT=20 LCP_FAILURE=3 LCP_INTERVAL=20 CLAMPMSS=1412 CONNECT_POLL=6 CONNECT_TIMEOUT=60 DEFROUTE=yes SYNCHRONOUS=no ETH=eth2 (对应新线路的网卡) PROVIDER=DSLppp1 USER=isp提供的新用户名字2 PEERDNS=no ...

2009-03-31 · 3 min · 447 words · admin

语言栏去掉CH问题

右键语言栏点击设置,先添加一个EN的键盘,比如英语(美国)键盘-美式键盘,然后确定之后再次修改输入法,删除这个英语的!那么就再也不会出现CH和EN的列表了!就是单单的输入法列!

2009-03-31 · 1 min · word · admin

Creating A Local Yum Repository (CentOS)

Author & Content of this howto, Tim Haselaars (http://www.trinix.be) Sometimes it can be handy to set up your own repository to prevent from downloading the remote repository over and over again. This tutorial shows how to create a CentOS mirror for your local network. If you have to install multiple systems in your local network then all needed packages can be downloaded over the fast LAN connection, thus saving your internet bandwidth. ...

2009-03-31 · 2 min · 230 words · admin

Weblogic下载地址

windows版: http://download2.bea.com/pub/releases/810/server811_win32.exe 253MB http://download2.bea.com/pub/platform/81/platform812_zh_CN_win32.exe 485MB http://download2.bea.com/pub/platform/81/platform812_win32.exe 478MB http://download2.bea.com/pub/platform/81/platform814_zh_CN_win32.exe 480MB http://download2.bea.com/pub/platform/81/platform814_win32.exe 450MB http://download2.bea.com/pub/platform/81/platform815_zh_CN_win32.exe 557MB http://download2.bea.com/pub/platform/81/platform815_win32.exe 512MB http://download2.bea.com/pub/platform/81/platform816_zh_CN_win32.exe 531MB http://download2.bea.com/pub/platform/81/platform816_win32.exe 506MB http://download2.bea.com/pub/platform/92/platform920_win32.exe 857MB http://download2.bea.com/pub/platform/92/platform921_win32.exe 916MB http://download2.bea.com/pub/platform/92/platform922_win32.exe 916MB http://download2.bea.com/pub/platform/81/server812_win32.exe 288MB http://download2.bea.com/pub/platform/81/server813_win32.exe 312MB http://download2.bea.com/pub/platform/81/server814_win32.exe 291MB http://download2.bea.com/pub/platform/81/server815_win32.exe 294MB http://download2.bea.com/pub/platform/81/server816_win32.exe 335MB http://download2.bea.com/pub/platform/90/server900_zh_CN_win32.exe 331MB http://download2.bea.com/pub/platform/90/server900_win32.exe 325MB http://download2.bea.com/pub/platform/91/server910_zh_CN_win32.exe 362MB http://download2.bea.com/pub/platform/91/server910_win32.exe 356MB http://download2.bea.com/pub/platform/92/server920_zh_CN_win32.exe 669MB http://download2.bea.com/pub/platform/92/server920_win32.exe 601MB http://download2.bea.com/pub/platform/92/server921_win32.exe 617MB http://download2.bea.com/pub/platform/92/server922_win32.exe 667MB http://download2.bea.com/pub/platform/100/server100_win32.exe 667MB linux版: http://download2.bea.com/pub/platform/81/platform811_linux32.bin 380MB http://download2.bea.com/pub/platform/81/platform812_linux32.bin 457MB http://download2.bea.com/pub/platform/81/platform813_linux32.bin 422MB http://download2.bea.com/pub/platform/81/platform814_linux32.bin 442MB http://download2.bea.com/pub/platform/81/platform815_linux32.bin 503MB http://download2.bea.com/pub/platform/81/platform816_linux32.bin 503MB http://download2.bea.com/pub/platform/92/platform920_linux32.bin 862MB http://download2.bea.com/pub/platform/92/platform921_linux32.bin 921MB http://download2.bea.com/pub/platform/92/platform922_linux32.bin 982MB http://download2.bea.com/pub/platform/81/platform812_linux64.bin 456MB http://download2.bea.com/pub/platform/81/platform813_linux64.bin 429MB http://download2.bea.com/pub/platform/81/platform815_linux64.bin 500MB http://download2.bea.com/pub/platform/81/platform816_linux64.bin 476MB http://download2.bea.com/pub/platform/92/platform921_generic.jar 733MB http://download2.bea.com/pub/platform/92/platform922_generic.jar 740MB http://download2.bea.com/pub/platform/81/server812_linux32.bin 264MB http://download2.bea.com/pub/platform/81/server813_linux32.bin 287MB http://download2.bea.com/pub/platform/81/server814_linux32.bin 293MB http://download2.bea.com/pub/platform/81/server815_linux32.bin 294MB http://download2.bea.com/pub/platform/81/server816_linux32.bin 432MB http://download2.bea.com/pub/platform/90/server900_linux32.bin 326MB http://download2.bea.com/pub/platform/91/server910_linux32.bin 363MB http://download2.bea.com/pub/platform/92/server920_linux32.bin 606MB http://download2.bea.com/pub/platform/92/server921_linux32.bin 622MB http://download2.bea.com/pub/platform/92/server922_linux32.bin 677MB http://download2.bea.com/pub/platform/100/server100_linux32.bin 672MB http://download2.bea.com/pub/platform/81/server812_linux64.bin 263MB http://download2.bea.com/pub/platform/81/server813_linux64.bin 294MB http://download2.bea.com/pub/platform/81/server814_linux64.bin 299MB http://download2.bea.com/pub/platform/81/server815_linux64.bin 291MB http://download2.bea.com/pub/platform/81/server816_linux64.bin 314MB http://download2.bea.com/pub/platform/90/server900_generic.jar 236MB http://download2.bea.com/pub/platform/91/server910_generic.jar 246MB http://download2.bea.com/pub/platform/92/server920_generic.jar 276MB http://download2.bea.com/pub/platform/92/server921_generic.jar 273MB http://download2.bea.com/pub/platform/92/server922_generic.jar 274MB http://download2.bea.com/pub/platform/100/server100_generic.jar 356MB hp_ux版: http://download2.bea.com/pub/platform/81/server815_hpux32.bin 326MB http://download2.bea.com/pub/platform/81/server816_hpux32.bin 332MB http://download2.bea.com/pub/platform/90/server900_zh_CN_hpux32.bin 330MB http://download2.bea.com/pub/platform/90/server900_hpux32.bin 324MB http://download2.bea.com/pub/platform/91/server910_zh_CN_hpux32.bin 392MB http://download2.bea.com/pub/platform/91/server910_hpux32.bin 386MB http://download2.bea.com/pub/platform/92/server920_zh_CN_hpux32.bin 599MB http://download2.bea.com/pub/platform/92/server920_hpux32.bin 579MB http://download2.bea.com/pub/platform/92/server921_hpux32.bin 587MB http://download2.bea.com/pub/platform/92/server922_hpux32.bin 617MB http://download2.bea.com/pub/platform/100/server100_hpux32.bin 644MB ...

2009-03-31 · 1 min · 175 words · admin

linux下apache+weblogic安装配置

安装系统:redhat linux as 4 2.6.9 安装apache 我安装的是apache2 上网下载,解压,编译,安装 ./configure –prefix=/usr/local/apache –enable-so –with-mpm=worker Make install –with-mpm=worker 解释:worker是2.x 版本中全新的支持多线程和多进程相混合的MPM模型。由于使用线程来处理,所以可以处理相对海量的请求,而系统资源的开销要小于基于进程的服务器。但是, worker也使用了多进程,每个进程又生成多个线程,以获得基于进程服务器的稳定性。这种MPM的工作方式是Apache 2.x的发展趋势。 修改/usr/local/apache/conf/httpd.conf,其中的documentroot\ apache默认的用户和组是 User nobody Group #-1 关于worker mpm部分可以参考下面的 StartServers 3 MaxClients 1984 MinSpareThreads 25 MaxSpareThreads 75 ServerLimit 80 ThreadLimit 200 ThreadsPerChild 64 MaxRequestsPerChild 0 安装cronolog 功能:记录日志功能 下载,编译,安装就不说了。 我是安装到/usr/local/cronolog目录。 修改/usr/local/apache/conf/httpd.conf,找到其中的CustomLog行,修改为下面的 CustomLog “|/usr/local/cronolog/sbin/cronolog /usr/local/apache/logs/access_log.%Y%m%d” combined 还需要修改/usr/local/apache/conf/httpd.conf,在最后面添加下面一行,这样以后其他配置文件都放到/usr/local/apache/conf.d目录下面。 Include conf.d/*.conf 做了上面的设置之后,测试一下配置文件是否有问题 /usr/local/apache/bin/apachectl –t /usr/local/apache/bin/apachectl {start|restart|graceful|stop} 安装weblogic 由于我是在远程安装,所以用参数:-mode=console ./ server815_linux32.bin -mode=console 安装完之后,还需要新建一个域。新建域的方法是使用/usr/local/wls813/common/bin/config.sh命令 接下来还需要给安装的weblogic添加license,否则只能接收3个ip的连接。 上网找个无限制的连接文件。下载,解压后, 将weblogic_sp.jar放到/usr/local/wls813/server/lib/下面,将license.bea放到/usr/local/wls813/bea下面。 启动weblogic的命令为 /usr/local/wls/startWebLogic.sh ...

2009-03-31 · 1 min · 91 words · admin