How to configure a jsp server in linux environment

  
                  

The people who contact the JSP server basically start from the JSP installation, because JSP does not have any installation process like ASP, and there is no automatic installation package like PHP. The JSP installation is a comparison. Trouble, manual steps are very many, let's explain step by step, how to configure a jsp server in the Linux environment.

First, install Jdk

cd to your jdk installation file directory

cp ./j2sdk-1_4_0-linux.bin /usr/local

Cd /usr/local

chmod a+x j2sdk-1_4_0-linux.bin

./j2sdk-1_4_0-linux.bin

Then follow the installation wizard to install After the jdk directory is /usr/local/jdk1.4

Second, install Apache

If you have already installed Apache when installing the operating system, uninstall it. Using the RPM Manager to uninstall Apache and its related packages, only the source-level compiled and installed operating system is the most thorough system installation, you can really control it.

cd to the apache source file directory you downloaded

tar xvzf apache*

./configure --prefix=/usr/local/apache --enable-module= So

make;make install

Third, install Resin

cd to your downloaded apache source file directory

tar xvzf resin* /usr/local

cd /usr/local/resin*

./configure --with-apache=/usr/local/apache

make;make install

Fourth, set the profile

vi/etc/profile//You can also open it with another text editor, add the following variable

JAVA_HOME=/usr/local/jdk1.4 < Br>

RESIN_HOME=/usr/local/resin-2.0

CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib //If you have other system-level libraries or drivers, continue Write down, separate with colon

PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

export JAVA_HOME RESIN_HOME CLASSPATH PATH

Save this after modification Log out, then log back in, open the command console, enter env If you see your environment variable in the returned output, it succeeds.

V. Configuring DNS

vi/etc/named.conf

Add the following statement:

zone 45it.com{

Type master;

file "45it.com";
}

zone 1.168.192.in-addr.arpa{

type master;

file "192.168.1";

}

Then create these two configuration files:

touch /var/named/45it.com Create www in it NS or CNAME record

touch /var/named/192.168.1 Establishing a domain name pointer in it

After the configuration is complete, run the following command:

ndc restat

nslookup

An interactive command line will appear when running nslookup. If you enter www.45it.com and return its IP address normally, the domain name will be resolved successfully.

VI. Configuring Apache

Creating a Site Root Directory

mkdir /www

mkdir /www/www.45it.com

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

Add the following statement to create a virtual host where you can change your domain name and IP.

NameVirtualHost 192.168.1.1 //machine ip

VirtualHost www.45it.com

ServerAdmin [email protected]

DocumentRoot /www/www. 45it.com

ServerName www.45it.com

ErrorLog logs/www.45it.com-error_log

CustomLog logs/www.45it.com-access_log common

/VirtualHost

After saving the above statement, then run apache restart, this will create a WEB site with the domain name http://www.45it.com, but it does not support it now. Jsp.

Also, if you want to use index.jsp as your site default file, find the DirectoryIndex line in httpd.conf and add index.jsp with spaces to separate from other file names.

VII, configuration Resin

vi /usr/local/resin*/conf/resin.conf

1) Cancel port 8080: share port 80 with Apache port, find , delete this line, if you want insurance, then you can comment it, or change 8080 to 80;

2) Create a virtual host that supports jsp: found in the configuration file, carriage return is added after it The following statement:

host id=www.45it.com

app-dir/www/www.45it.com/app-dir

classpath id=bean source= Bean compile=true

/host

Save and exit after configuration, www.45it.com will support jsp, and use bean as the root directory for storing javabeans.

VIII. Restart the service

Establish a symbolic link:

ln -s /usr/local/apache/bin/apachectl /usr/bin/apache

ln -s /usr/local/resin*/bin/srun.sh /usr/bin/jsp

Restart Apache and Resin services:

apache start

jsp start

IX. Establish FTP account

At this point, jdk, dns, apache, and resin are all configured. Now create FTP

useradd 45it //account name

passwd 45it //Enter the password, no less than six digits, case sensitive

Execute the above command to create the /home/45it directory, delete it, and then run the following command

Ln -s /www/www.45it.com /home/45it

Note: Change the folder attribute of /www/www.45it.com, set Owner to 45it user, Group to 45it group, and give User has read and write permissions, Other has read permissions, if you don't do this, logging in to FTP will say that you don't have permission, and you can't browse the domain name site.

If you want to add 45it users to the ftp guest group from a security perspective, it will implement 45it users with /www/www.45it.com as their root directory to prevent other directories from being operated. At this point, you can use the ftp tool to log in to your FTP site on the client and upload your site files.

X. Test Site

Add the DNS server to your server IP in the client's network configuration, so that the domain name you set above can be accessed.
If you do not use the network configuration or conflict with the DNS server on the Internet, go to the c:/windows or c:/winnt directory to find the HOSTS file, add the following line: 192.168.1.1 www.45it.com. The front is the IP of your server, followed by your domain name, separated by TAB. Use a tool such as Ultradev to create a local site, remotely set to the ftp set above, and then create a test.jsp file with only one sentence: 1+1=<%=1+1>.

Upload the file to the server, that is, upload it to the /www/www.45it.com directory, and browse to http://www.45it.com/test.jsp in the client browser, if you return 1+1=2, the test was successful.

Copyright © Windows knowledge All Rights Reserved