免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1286 | 回复: 0
打印 上一主题 下一主题

Linux+Apaceh+iASP+ASP [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-19 14:02 |只看该作者 |倒序浏览
在rhel5.4运行ASP

Linux+Apaceh+iASP+ASP连接到独立的MSSQL服务器上。
一、原理
要在Linux环境中运行ASP,需要依赖第三方的中间环境。通常有几种模式:
引用
1、Apache_ASP功能模块,兼容性不好,而且不能连接数据库,意义不大;
2、Instant ASP java模块(简称iASP),可支持Apache、Zenus等Web服务,可连接数据库,效果不错;
3、Sun one ASP模块,效果最好,但收费很贵,测试版只有30天试用期,而且速度慢。
环境:rhel5.4
所需包
jdk-6u23-linux-i586.bin
iASP2.1.01.tar.gz
 httpd-2.2.8.tar.gz
 
 
【安装apache】
[root@tomcat src]# tar jxvf httpd-2.2.8.tar.gz
[root@tomcat src]# cd httpd-2.2.8
[root@jerome-1 httpd-2.2.8]# ./configure --prefix=/usr/local/apache2 \
--with-mpm=worker --enable-cache  \
--enable-file-cache  --enable-disk-cache  \
--enable-mem-cache  --enable-mime-magic  \
--enable-headers  --enable-ssl  \
--enable-http --enable-cgi \
--enable-rewrite --enable-so \
--with-suexec-gidmin \
--with-suexec-logfile
[root@jerome-1 httpd-2.2.8]# make && make install
[root@jerome-1 httpd-2.2.8]# /usr/local/apache2/bin/apachectl start
[root@tomcat httpd-2.2.11]# ps aux | grep httpd
二、配置java环境

1、安装
# chmod +x jdk-6u23-linux-i586.bin
./jdk-6u23-linux-i586.bin
# mv jdk1.6.0_23   java
#mv java /usr/local/
#java -version
2、调整环境变量
红旗默认带有1.5.0版本的java环境:
[root@jerome-1 tomcat]#  vim /etc/profile
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jar
PATH=$JAVA_HOME/bin:$PATH:${CATALINA_HOME}/bin:${PATH}
export JAVA_HOME CATALINA_HOME CLASSPATH PATH
使用source或.指令使修改生效
[root@jerome-1 tomcat]# source /etc/profile
三、安装iASP 2.1.1

# mkdir iASP_dir
# tar xzvf iASP2.1.01.tar.gz -C iASP_dir/
# cd iASP_dir/
# ./install.sh
输入上述java环境的目录:

Please enter the full path to your JDK's bin directory.
e.g. /usr/jdk1.1.6/bin, Q/q(quit), S/s(skip):
/usr/local/java/bin/
输入iasp的安装路径:
引用
Enter the absolute directory under which Instant ASP should be installed.
(./iasp21 will be created underneath.)
> /usr/iasp
Directory /usr/iasp does not exist,  create it (Y/N/Q)?
> y
※目录的最后都不要加“/”符号
对Web服务器进行配置,这里用得是Apache 2.0版本:
引用
Would you like to configure your web server for Instant ASP now [Y/N]?y
Do you want to continue (Y/N)? y
Please choose a servlet interface
[1]  Instant ASP native servlet interface
[2]  Apache JServ
Enter a number [1/2]: 1
***** Please select a web server  *****
[1]  Netscape
[2]  Apache
[3]  Xitami
[0]  Quit
Enter a number [0-4]: 2
*****    Please choice Apache version    *****
[1]  Apache 1.3.0
[2]  Apache 1.3.1
[3]  Apache 1.3.2
[4]  Apache 1.3.3
[5]  Apache 1.3.4
[6]  Apache 1.3.6
[7]  Apache 1.3.9
[8]  Apache 1.3.11
[9]  Apache 1.3.12
[10] Apache 1.3.14
[11] Apache 1.3.2X
[12] Apache 2.X
[0]  Quit
Note:  If you are using Apache Web Server higher version or have additional
      modules, such as Front Page Server Extensions, Raven SSL, or you are
      using Apache Strong Hold Server. Please configure iASP according
      to <iASP_Home>/bin/apache/source/readme.txt
Enter a number [0-10]: 12
Please enter the path to the Apache /conf directory >/etc/httpd/conf
setting for "Proxy host IP address" <127.0.0.1>
setting for "Proxy port" <9098>
setting for "Server manager port" <9095>
"httpd.conf"configuration completed.
Would you like to configure another web server (Y/N)?n
Configuration successful.
You can access the Instant ASP documentation and samples
from the virtual directory /iasp/
结果:

Server Information:
iASP Path:          /usr/iasp/iasp21
iASP Version:       2.1.01
OS Name:            Linux  2.6.9-42.7AXsmp
Host IP:            192.168.228.250
Java Path:          /usr/java/j2re1.4.2_15
Java Version:       1.4.2_15
Java Vendor:        Sun Microsystems Inc.
iASP License:       No License
3、配置
如果这个使用启动Apache,会报错:
引用
# service httpd start
启动 httpd:httpd: module "mod_iasp.c" is not compatible with this version of Apache (found 20020329, need 20020903).
Please contact the vendor for the correct version.
                                                          [失败]
这是由于iasp自带的模块是基于20020329的Apache版本编译的。所以加载失败。我们需要手动的为当前版本配置一个新模块:
# cd /usr/iasp/iasp21/bin/apache/source/2.0/
# apxs -i -c *.c
完成启动apache的时候,会出现下面这个问题:
[root@localhost ~]# /usr/local/apache2/bin/apachectl start
httpd: Syntax error on line 412 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/iasp/iasp21/bin/apache/linux/2.0/mod_iasp.so into server: /usr/local/iasp/iasp21/bin/apache/linux/2.0/mod_iasp.so: undefined symbol: ap_run_http_method

出现这个问题是因为在iasp2.11发布的时候apache最高版本是2.0.x. 而2.0和2.2是两个不同的开发分支有很多不同。2.0里面的mod和apr API多数不一样。
解决办法是把我的附件中的文件全部复制到
/usr/iasp21/bin/apache/source/2.0中
之后
cd /usr/iasp21/bin/apache/source/2.0
编译
/usr/local/apache2/bin/apxs -i -c *.c
这时候mod_iasp.so 已经在/usr/local/apache2/modules中
修改/usr/local/apache2/httpd.conf
LoadModule iasp_module "/usr/iasp21/bin/apache/linux/2.0/mod_iasp.so
这句改成了
/usr/local/apache2/modules/mod_iasp.so
这样就OK了

在Linux上运行ASP
启动Apache即可:
# /usr/local/apache2/bin/apachectl start
4、启动
启动iasp代理模块:
# /usr/iasp/iasp21/start-server.sh &
logging to stdout
iASP/2.1.01 started
[1] 13846
监听端口:
# netstat -ln&#124;grep 9098
tcp        0      0 :::9098                     :::*                        LISTEN
停止:
# /usr/iasp/iasp21/stop-server.sh
iASP server stopped
四、测试ASP在Linux上的运行
1、创建asp源代码
创建一个test.asp文件:
引用
<html>
<head>
<title>Test iASP</title>
</head>
<body>
<%
Response.Write "<BR><h1>Congradulations!<BR>Instant ASP has worked for you!</h1>"
%>
</body>
</html>

测试页面
Congradulations!
Instant ASP has worked for you!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP