Category: Tech

  • 防火墙后的Jboss-EJB调用

    要点:
    除了我写的中文资料,日期截至到日志当日的中文资料不可看,全是错的,基本上胡说八道。
    Jboss的EJB应用如果在防火墙后面,通过端口1098和1099调用,需要另外打开3873端口供socket调用,同时需要修改rmi-server地址为外部IP地址或域名。

    配置文件一共需要修改四处,下面以域babyken.org内,防火墙后主机IP192.168.1.25为例,

    1.首先修改jboss-service.xml,在ejb端口1098附近,修改CallByValue值为true
    <attribute name=”CallByValue”>true</attribute>

    2.然后修改ejb3.deployer中jboss-service.xml文件,主要是添加域名到3873的调用中
    ——
    <mbean code=”org.jboss.remoting.transport.Connector”
    name=”jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3″>
    <depends>jboss.aop:service=AspectDeployer</depends>
    <attribute name=”Configuration”>
    <config>
    <invoker transport=”socket”>
    <attribute name=”numAcceptThreads”>1</attribute>
    <attribute name=”maxPoolSize”>300</attribute>
    <attribute name=”clientMaxPoolSize” isParam=”true”>50</attribute>
    <attribute name=”timeout” isParam=”true”>60000</attribute>
    <attribute name=”serverBindAddress”>${jboss.bind.address}</attribute>
    <attribute name=”serverBindPort”>3873</attribute>
    <!– that’s the important setting –>
    <attribute name=”clientConnectAddress”>babyken.org</attribute>
    <attribute name=”clientConnectPort”>3873</attribute>

    <attribute name=”backlog”>200</attribute>
    </invoker>
    <handlers>
    <handler subsystem=”AOP”>org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
    </handlers>
    </config>

    </attribute>
    </mbean>
    ——

    3.设置java启动选项,添加rmi-server的外部地址和禁用本地域名解析到启动脚本
    Windows脚本例:set JAVA_OPTS=-Djava.rmi.server.hostname= babyken.org -Djava.rmi.server.useLocalHostname=false
    Unix脚本例:添加到jboss启动配置文件run.conf中即可。

    4.用run.sh –host=192.168.1.25启动服务或添加–host=192.168.1.25到启动脚本。

  • 尝试了一把nginx和php-fastcgi

    尝试了一把nginx和php-fastcgi,感觉速度好像是快了点,也许是错觉,不过以nginx四百多K的体积能做到这样我觉得相当不错,简要写一下配置。首先当然是安装nginx,不管你是编译还是二进制,这个没有太多可以说的,差不多,然后呢是编译php,在apache下面安装习惯了,一直没把–with-apxs去掉,我就说怎么一直不给生成那个php-cgi文件呢,搞了半天是不能同时使用的,靠,configure的时候又不提示一下,无效开关应该要提示才对的嘛,接下来是修改一下php.ini,修改说明如下:

    ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP’s
    ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
    ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
    ; this to 1 will cause PHP CGI to fix it’s paths to conform to the spec. A setting
    ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
    ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
    cgi.fix_pathinfo=1

    倒数第二步呢,当然就是启动php-cgi server,使用命令行启动:php-cgi -b 127.0.0.1:9000 使得其监听在本地9000端口,最后一步就是修改nginx配置了,MMP的配置文件里面居然还有语法,所以不流行撒,看apache的配置都形成了一个规范,配置文件是这样的,其它部分我跳过了,不用修改,只写下修改的虚拟主机部分,我们以bbs.teafter.com为例:

    ###############bbs.teafter.com######哈利路亚#########
    server {
    listen 80;
    server_name bbs.teafter.com;
    location / {
    index index.html index.htm index.php;
    root /usr/local/www/bbs.teafter.com;
    }
    location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /usr/local/www/bbs.teafter.com/$fastcgi_script_name;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    }
    }

    当然了,一些细小的配置,例如gzip压缩,rewrite,用户验证等等,我再研究下了来,可是想了想,按照web应用的细分,这种结构是为了极大负载设计,那么就不应该有rewrite,用户验证这些东西,simple is the best~

  • weblog ping

    http://rpc.weblogs.com/RPC2,

    http://api.my.yahoo.com/RPC2,

    http://www.blogdigger.com/RPC2,

    http://rcs.datashed.net/RPC2,

    http://www.feedsky.com/api/RPC2,

    http://ping.blog.gs,

    http://blogsearch.google.com/ping/RPC2,

    http://ping.feedburner.com,

    http://api.moreover.com/RPC2