Sep
13
三、安装iASP 2.1.1
正如前面提到的,负责iASP开发公司的网站已经上不去了。下面提供下载地址:

1、解压
# mkdir iASP_dir
# tar xzvf iASP2.1.01.tar.gz -C iASP_dir/
iasp21.tar
install.sh
README
# tar xzvf iASP2.1.01.tar.gz -C iASP_dir/
iasp21.tar
install.sh
README
2、安装
# cd iASP_dir/
# ./install.sh
# ./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/java/j2re1.4.2/bin
e.g. /usr/jdk1.1.6/bin, Q/q(quit), S/s(skip):
/usr/java/j2re1.4.2/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
(./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/
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
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.
[失败]
启动 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
# apxs -i -c *.c
新生成的模块放在:
引用
/usr/lib/httpd/modules/mod_iasp.so
修改/etc/httpd/conf/httpd.conf文件为:
引用
#LoadModule iasp_module "/usr/iasp/iasp21/bin/apache/linux/2.0/mod_iasp.so"
LoadModule iasp_module "/usr/lib/httpd/modules/mod_iasp.so"
LoadModule iasp_module "/usr/lib/httpd/modules/mod_iasp.so"
启动Apache即可:
# service httpd start
引用
启动 httpd: [ 确定 ]
4、启动
启动iasp代理模块:
引用
# /usr/iasp/iasp21/start-server.sh &
logging to stdout
iASP/2.1.01 started
[1] 13846
logging to stdout
iASP/2.1.01 started
[1] 13846
监听端口:
引用
# netstat -ln|grep 9098
tcp 0 0 :::9098 :::* LISTEN
tcp 0 0 :::9098 :::* LISTEN
停止:
引用
# /usr/iasp/iasp21/stop-server.sh
iASP server stopped
iASP server stopped
四、测试ASP在Linux上的运行
1、创建asp源代码
在/var/www/html/目录下创建一个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>
<head>
<title>Test iASP</title>
</head>
<body>
<%
Response.Write "<BR><h1>Congradulations!<BR>Instant ASP has worked for you!</h1>"
%>
</body>
</html>
2、查看结果

可以看到,ASP代码可直接运行在Linux的Apache环境中。
接下来,您可以修改httpd.conf中的配置,增加虚拟主机、虚拟目录、默认字符集、默认index.asp文件等Apache功能,以实现更多元化的工作。甚至在一台服务器上同时运行php和asp模块也是没有问题的。
除了简单的ASP代码外,接下来要做的,就是连接数据库的事情。

我也出现这个问题
# cd /usr/iasp/iasp21/bin/apache/source/2.0/
# apxs -i -c *.c
对比IIS,Apache可靠性和安全性确实好些,但更多的还需要考虑实际管理的操作。我这里仅是提供了一个或许可行的版本,但测试的应用都是比较简单的,不一定能满足大网站的全部要求,对于想完全迁移到Linux系统的应用来说,我更建议该为跨平台的架构,如jsp、php等。
另外,iasp可以支持中文内容提交的,你可以看看另外两篇文章,连接mysql和mssql数据库。但这是特例,和java环境有关。
# rpm -qf /usr/sbin/apxs
httpd-devel-2.0.52-12.ent.2AX
江苏linux
下面这个留言版就是一个案例:
http://guestbook.linuxfly.org