Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement Apache to support ASP.NET+JSP in mod_aspdotnet

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about mod_aspdotnet how to achieve Apache to support ASP.NET+JSP, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

1. Brief description of Apache support for ASP.NET:

1. Install the software used:

Apache_2.0.55-win32-x86-no_ssl.msi

Mod_aspdotnet-2.0.0.msi

DotNetFramework1.1

Sun Java System Active Server Pages 4.0

Jdk-1_5_0_04-windows-i586-p.exe

Apache-tomcat-6.0

Mod_jk_1.2.6_2.0.50.dll

2. Mod_aspdotnet description: mod_aspdotnet is a stopped project of the Apache Foundation, which provides Microsoft ASP.NET application support for Apache Web servers in a modular manner. The mod_aspdotnet-2.0.0.msi we downloaded only supports Apache2.0.x. Currently, this module fully supports Asp.Net 1.1 with .NET Framework v1.0 or v1.1 and experimental support for Asp.Net 2.0, but does not work with .NET Framework 2.0. At present, the problem with this mod_aspdotnet module is the lack of authentication support, such as windows and form.

Now the newly updated mod_aspdotnet-2.2.0.2004-snapshot-rev419792.msi provides the mod_aspdotnet module for Apache 2.2.x.

3. Sun Java System Active Server Pages 4.0description: Sun Java System Active Server Pages 4.0( formerly known as Sun ONE Active Server Pages) is a secure cross-platform Active Server Pages (ASP) engine. Java System ASP allows organizations to improve Web security by promoting deployed ASP applications from Microsoft IIS to Java System Web Server (formerly known as Sun ONE Web Server) or Apache running on the Solaris operating system, Linux, or Windows. Java System ASP is fully compatible with Microsoft ASP 3.0 and general Web authoring tools such as Macromedia's Dreamweaver MX and Microsoft FrontPage.

Sun ONE Active Server Pages 4.0allows deployment of Web applications written in Active Server Pages on a variety of Web services and platforms. This means that Microsoft Web developers can use existing tools to create cross-platform Active Server Pages applications, while organizations can deploy Active Server Pages-based content in secure, highly available Web servers and operating environments.

4. Mod_jk_1.2.6_2.0.50 description: mod_jk_1.2.6_2.0.50 is an old mod_jk. Since Apache2.0.59, Apache has a new correspondence for mod_jk. For more information, please see the Apache website.

Second, install Apache

After downloading Apache, double-click the apache_2.0.55-win32-x86-no_ssl.msi file. Select the agreement terms, click Next; to enter the domain name (without www) in the box of Network Domain, enter the domain name with prefix (with www or other prefixes) in ServerName, enter your Email address in Email Address, click the For All Users box, and then Next all the way.

3. Install the .NET Framework

Double-click dotnetfx.exe, and you can also Next all the way.

Fourth, install mod_aspdotnet

Be sure to install Apache and .NET Framework before installing mod_aspdotnet.

Double-click mod_aspdotnet-2.0.0.msi, select the agreement terms, click Next; to select the All Users checkbox, and Next all the way.

5. Install JDK

Double-click the jdk-1_5_0_04-windows-i586-p.exe file. Just Next all the way.

6. Install Sun Java System Active Server Pages 4.0,

Be sure to install Apache before installation. If JDK is not installed before installation, double-click sjsasp402-windows.exe will install J2SE v1.4.2Secret05 first, and then double-click sjsasp402-windows.exe again after J2SE v1.4.2Secret05 has been installed before Sun One ASP installation. Start the installation, Next all the way to Choose A Web Server, select Apache Web Server 2.0.55, click Next, pop up a prompt box requiring to disable the Apache service, turn off the Apache service as required, click OK, and start to enter the * installation phase. After installation, click the finish button, and the installation is successful. Start the Apache service after the installation is successful.

7. Install Tomcat

Tomcat installation can be installed by default.

8. Install mod_jk

Copy mod_jk_1.2.6_2.0.50.dll to the modules directory under the Apache installation directory, coincident with the name mod_jk.dll

9. Configure httpd.conf

Go to the Apache installation directory, find the conf folder, and double-click to enter. Open the httpd.conf file in text and add to the * * section of the file:

# load asp.net module LoadModule aspdotnet_module "modules/mod_aspdotnet.so" # if mod_aspdotnet loads successfully

< IfModule mod_aspdotnet.cpp>

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo # For all virtual ASP.NET webs, we need the aspnet_client files # to serve the client-side helper scripts. AliasMatch ^ / (? I) aspnet_client/system_web/ (\ d +) _ (\ d +) / (. *) "C:/WINNT/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"

< Directory "C:/WINNT/Microsoft.NET/Framework/v*/ASP.NETClientFiles">

Options FollowSymlinks Order allow,deny Allow from all

< /Directory>

< /IfModule>

< VirtualHost *:80>

ServerAdmin $Mail_address DocumentRoot "$Apache_home\ htdocs" ServerName $serverName DirectoryIndex index.jsp index.asp index.aspx index.htm # if mod_aspdotnet loads successfully

< IfModule mod_aspdotnet.cpp>

# load ASP.NET application. When * parameter is "/", the entire virtual host needs to support asp.net AspNetMount / "$Apache_home\ htdocs" # set the virtual directory of application asp.net. When the entire virtual host needs to support asp.net, do not set # Alias / active "$Apache_home\ htdocs\ active" # allow asp.net scripts to execute the following directories

< Directory "$Apache_home\htdocs">

Options FollowSymlinks ExecCGI Order allow,deny Allow from all

< /Directory>

< /IfModule>

< /VirtualHost>

# load mod_jk module LoadModule jk_module "modules/mod_jk.dll"

< IfModule mod_jk.c>

# workers.properties address JkWorkersFile $Tomcat_home/conf/workers.properties # log file JkLogFile $Tomcat_home/logs/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the timestamp log format JkLogStampFormat "[% a% b% d% H:%M:%S% Y]" # Send * .do * .jsp,*.xls files to worker named ajp13 JkMount / * .do ajp13 JkMount / * .jsp ajp13

< /IfModule>

In the application, you should change the above $Tomcat_home to the Tomcat installation directory; change the $Apache_home to the Apache installation directory; change the $serverName to the host name, which can be written into the IP address without the host name; and change the $Mail_address to your email address.

10. Configure workers.properties

Create a new file in the conf directory under the Tomcat installation directory

Workers.properties: workers.tomcat_home=$Tomcat_home workers.java_home=$Java_home ps=\ worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=$serverName worker.ajp13.type=ajp13 worker.ajp13.lbfactor=1

In the application, you should change the above $Tomcat_home to the Tomcat installation directory; change the $Java_home to the JDK installation directory; change the $serverName to the host name, and you can write the IP address if you do not have a virtual host.

11. Configure Tomcat virtual host

Open the server.xml file in the conf directory under the Tomcat installation directory and find the

< /Engine>

Tag, add to it:

< Host name="$serverName " appBase="$Apache_home\htdocs" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">

< Context path="" docBase="." debug="0"/>

< !--一定要有这一句,这一句设定当前目录为根目录 -->

< /Host>

In the application, you should change the above $Apache_home to the installation directory of Apache; change $serverName to the host name, and you can write the IP address without the host name.

Note: the directory of the Tomcat virtual host and the directory of the Apache virtual host must be the same, and the host name must be the same (that is, the appBase attribute value of the Host tag in Tomcat should be the same as the DocumentRoot value of the VirtualHost tag in Apache; that is, the name attribute value of the Host tag in Tomcat should be the same as the ServerName of the VirtualHost tag in Apache;), but the port is different, one is 80, the other is 8080, otherwise there will be questions when you ask index.jsp.

12. Test Apache support for ASP.NET

Add three HelloWorld files to the root directory of the virtual host and test them for HelloWorld.aspx, HelloWorld.asp, and HelloWorld.jsp:

HelloWorld.aspx:

< %@ Page Language="VB" %>

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

< script runat="server">

< /script>

< html xmlns="http://www.w3.org/1999/xhtml"; >

< head runat="server">

< title>

Hello World!-mod_aspdotnet

< /title>

< /head>

< body>

< form id="form1" runat="server">

< div>

< % Response.Write("< h2>

Hello World!

< /h2>

")% >

< /div>

< /form>

< /body>

< /html>

Open the browser, type: http://$serverName/HelloWorld.aspx in the address bar, and change the $serverName above to the hostname

If you output Hello World correctly!

It shows that your configuration is correct, and now Apache supports ASP.NET.

HelloWorld.asp:

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

< html xmlns="http://www.w3.org/1999/xhtml"; >

< head>

< title>

Hello World!-Sun One ASP

< /title>

< /head>

< body>

< form id="form1">

< div>

< % Response.Write "< h2>

Hello World!

< /h2>

"% >

< /div>

< /form>

< /body>

< /html>

Open the browser, type: http://$serverName/HelloWorld.asp in the address bar, and change the $serverName above to the hostname

If you output Hello World correctly!

It shows that your configuration is correct, and now Apache supports ASP.

HelloWorld.jsp:

< %@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

< html xmlns="http://www.w3.org/1999/xhtml"; >

< head>

< title>

Hello World!-Tomcat

< /title>

< /head>

< body>

< form id="form1">

< div>

< % out.print ("< h2>

Hello World!

< /h2>

");% >

< /div>

< /form>

< /body>

< /html>

Open the browser, type: http://$serverName/HelloWorld.jsp in the address bar, and change the $serverName above to the hostname

If you output Hello World correctly!

It shows that your configuration is correct, and now you can use JSP in Apache.

XIII. Considerations for Apache to support ASP.NET

1. Because apache itself is case-sensitive to url directories and file names, the virtual directory of asp.net must pay attention to case, otherwise there will be no error during access, but no files will be found, just like accessing an empty directory. In addition to the virtual directory name, because other aspx files are loaded by the mod_aspdotnet module, they are still not case-sensitive.

This is how mod_aspdotnet implements Apache to support ASP.NET+JSP. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report