linux下安装iasp以及apache多站点虚拟主机配置

时间:2021-06-11 12:09:09

                     安装配置

1.     linux下安装iasp

1.1需要准备的的安装包:

httpd-2.0.59.tar.gz(最好选该版本,2.2版本在安装配置完后启动出错

iasp-2.1.01.tar.gz(在网上只找到该最高版本)

jdk(jdk版本没有要求,iasp的说明文档上要求jdk1.1以上即可)

 

1.2   apache安装:

  tar –zxvf httpd-2.0.59.tar.gz

  cd httpd-2.0.59

     ./configure --prefix=/usr/local/apache2 --enable-module=so  //配置安装路径

    make    //编译

  make install  //安装

 

1.3   jdk安装

假如jdk安装文件目录为/soft

cd  /soft

chmod 755 jdk-6u11-linux-i586.bin

./ jdk-6u11-linux-i586.bin

一路下去yes

配置jdk环境变量:

export JAVA_HOME=/usr/java/jdk1.6.0_27

export JAVA_BIN=/usr/java/jdk1.6.0_27/bin

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_HOME JAVA_BIN PATH CLASSPATH

让/etc/profile文件修改后立即生效 ,可以使用如下命令:
# . /etc/profile

注意: . 和 /etc/profile 有空格.

1.4 iasp安装

        sudo tar  –zxvf iasp-2.1.01.tar.gz  //解压

        sudo ./install.sh     //install.shiasp解压后得到的

        接下来显示如下:

Please enter the full path to your JDK's bin directory.
e.g. /usr/jdk1.1.6/bin, Q/q(quit), S/s(skip):
>(输入前面的jdk安装路径”)

Enter the absolute directory under which Instant ASP should be installed.
(./iasp21 will be created underneath.)
>(输入安装“iasp”的目录,我输入了“/usr/local/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 /bin/apache/source/readme.txt

Enter a number [0-10]:(输入“12”)
Please enter the path to the Apache /conf directory >
(我输入自己的安装目录名称/usr/local/apache2/conf)
"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/

1.4  iasp存在错误修复

由于iaspapache2.0以后会存在问题,研发iasp的公司后期没有继续新版本的开发,因此在apache2的环境中需要重新编译iasp,操作如下:

cd  /usr/local/iasp/ iasp21/bin/apache/source/2.0

sudo /usr/local/apache2/bin/apxs  –i –c  *.c  //重新编译iasp,生成的mod_iasp.so会在/usr/local/apache2/modules/下出现。谨记使用/usr/local/apache2/bin下面的apxs命令,别使用http-devel安装软件的apxs命令,切记

//修改httpd.conf配置文件

Httpd.conf配置会在apache安装路径以及系统配置里面出现,路径分别为

/usr/local/apache/conf/httpd.conf

/etc/httpd/conf/httpd.conf

该路径可以通过find / -name httpd.conf查找得到

sudo vi /usr/local/apache/conf/http.conf

在文件末尾部分将/usr/local/iasp/iasp21/bin/apache/linux/2.0/mod_iasp.so修改为

/usr/local /apache2/modules/mod_iasp.so

同时将/usr/local/apache/conf/http.conf后面部分关于iasp的配置直接复制到/etc/httpd/conf/httpd.conf的末尾即可(该文件之前要是存在iasp的配置内容则先删除,然后复制进去)

 

重新启动apacheiasp

 

/usr/local/apache2/bin/apachectl start

/usr/local/iasp/iasp21/start-server.sh

 

测试是否安装成功

vi /usr/local/apache2/htdocs/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>

在浏览器中输入http://ip(你服务器的ip地址)/test.asp

如果出现一下内容则表示配置成功:

Congratulations!
Instant ASP has worked for you!

2.     apache的多站点虚拟主机配置方法

在安装和配置完成iasp以后,在部署自己的系统工程时,需要为自己的系统工程配置工作目录,如果直接将自己的系统放置于/usr/local/apache2/htdocs/目录下会出错,单个的test.asp文件没有问题。一下为自己的系统工程配置工作目录:

cd /usr/local/apache2/conf

vi httpd.conf

httpd.conf的文件末尾加上
Include /usr/local/apache2/conf/vhost.conf
同时在 /usr/local/apache2/conf目录下,vi vhost.conf
内容如下:

NameVirtualHost 192.168.4.209:80

<VirtualHost 192.168.4.209:80>

   ServerName www.a.com

   ServerName www.b.com

   DocumentRoot "/usr/local/apache/www1"

   Alias /dj "/usr/local/apache/htdocs/dj2.0/"

  <directory "/usr/local/apache/www1">

   allow from all

  </directory>

   DirectoryIndex index.asp

</VirtualHost>

<VirtualHost 192.168.4.209:80>

   ServerName www.c.com

   DocumentRoot "/usr/local/apache/htdocs"

  <directory "/usr/local/apache/htdocs">

   allow from all

  </directory>

   DirectoryIndex index.asp

</VirtualHost>

以上配置解释如下:

本人服务器ip192.168.4.209,在端口80下配置

我的工作目录为/usr/local/apache/htdocs/dj2.0/,别名为/dj,文档根目录为/usr/local/apache/www1www1目录不存在需要先建立,不然启动apache时会有提示

 

下面测试配置是否成功:

在浏览器中输入http://192.168.4.209/dj/test.asp

Congratulations!
Instant ASP has worked for you!

配置成功!

以上为本人亲自配置经验,希望对您的配置提供帮助。

 

在此,不建议使用iasp,因为iasp存在过期问题,使用openAsp更为合适,请关注我的后面将发布的博客openAsp安装,openAsp的安装更为简单。