PHP + JSP + MYSQL + APACHE + RESIN Virtual Host Configuration

2010-08-30  来源:本站原创  分类:Web  人气:289 

LINUX platform in all configurations are completed and tested successfully complete integration and software as needed

resin: http://www.caucho.com/
jdk: http://java.sun.com/
apache: http://www.apache.org
mysql: http://www.mysql.com
php: http://www.php.net
jdbc: http://mmmysql.sourceforge.net/
I used the software version is as follows:
resin-3.0.10.tar.gz
j2sdk-1_4_2_05-linux-i586.bin
httpd-2.0.52.tar.gz
mysql-4.1.9.tar.gz
php-4.3.10.tar.gz
mysql-connector-java-3.1.6.tar.gz

1. Install MYSQL
I put all of his under the / root directory
# Chmod 755 mysql-4.1.9.tar.gz
# Tar xfz mysql-4.1.9.tar.gz
Unpacked mysql-4.1.9 directory, we have access to the directory:
cd mysql-4.1.9
After the start configuration into the mysql, and configuration settings, we give a mysql installation directory, we set in / usr / local / mysql, the thought that the file into a place easier to manage, if you want to get more configuration information, use. / configure - help:
Here I would like to stress at compile time to choose a good MYSQL default encoding, because if you do not choose when to install by default in JSP not support GBK encoding in so I am compiling
#. / Configure - prefix = / usr / local / mysql - with-charset = gbk
And so on for a few seconds after the completion of compiling the source code configuration
# Make
The compilation process is relatively long, if the machine is relatively slow, it may be close to 20 minutes (I think the server needs is 15 minutes). Compiled after the completion of installation:
# Make install
Wait a few seconds, the installation is complete. Here they arrive at a most critical part of, why the old install does not succeed, (at least I installed the N times, N>; 10, Oh), the key issue here, access to mysql a dedicated user, and must be given the appropriate access rights, where we set the mysql root and have access to.
We first create a mysql and the mysql user to access the mysql:
# Groupadd mysql # mysql group established
# Useradd mysql-g mysql # set up mysql to mysql user and group

After we set up the user initialization table (Note: must perform this step only after the following steps)

#. / Scripts / mysql_install_db - user = mysql # first test of the table and provides users with mysql to access the table after initialization and the start to the mysql root user to set access rights, we first install the mysql directory:

# Cd / usr / local / mysql

Then set the permissions

# Chown-R root. # Set root access to / usr / local / mysql
# Chown-R mysql var # set the mysql user to access / usr / local / mysql / var, which kept the mysql database files
# Chown-R mysql var /. # Set the mysql user to access / usr / local / mysql / var all files
# Chown-R mysql var / mysql /. # Set the mysql user to access / usr / local / mysql / var / mysql all files
# Chgrp-R mysql. # Set mysql group access to / usr / local / mysql

Set is complete, basically had loaded it, well, we run about our mysql:

# / Usr / local / mysql / bin / mysqld_safe - user = mysql &

If not, then, should appear like this prompt:

[1] 42264
# Starting mysqld daemon with databases from / usr / local / mysql / var

This proves the success you have installed MYSQL using the following command changes the password, the default installation password is empty, you must immediately amend the sake of security
/ Usr / local / mysql / bin / mysqladmin-uroot password pengyong
Now modify the code as: pengyong

Second, install jdk
# Chmod 755 j2sdk-1_4_2_05-linux-i586.bin
# ./j2sdk-1_4_2_05-linux-i586.bin Release j2sdk-1_4_2_05-linux-i586.bin
In the / root directory of directories and files generated j2sdk1.4.2_05 I would JDK installed to / usr / java / directory, file cut to / usr / java / directory
# Mv j2sdk1.4.2_05 / / usr / java /
Setting JDK environment variables

# Vi / etc / profile
# / Etc / profile
JAVA_HOME = / usr/java/j2sdk1.4.2_05
RESIN_HOME = / usr / resin
PATH = $ PATH: $ JAVA_HOME / bin
CLASSPATH =.: $ JAVA_HOME / lib / dt.jar: $ JAVA_HOME / lib / tools.jar: $ JAVA_HOME / lib / htmlco
nverter.jar: $ RESIN_HOME / lib: / usr/java/jdbc/mysql-connector-java-3.1.6-bin.jar
Environment currently logged out and re-login, so just set the environment variable will take effect, then use the following command to test:
[Root @ LINUX root] # echo $ JAVA_HOME
/ Usr/java/j2sdk1.4.2_05
[Root @ LINUX root] # echo $ CLASSPATH
.: / Usr/java/j2sdk1.4.2_05/lib/dt.jar: / usr/java/j2sdk1.4.2_05/lib/tools.jar: / usr /
java/j2sdk1.4.2_05/lib/htmlconverter.jar: / usr / resin / lib: / usr / java / jdbc / mysql-con
nector-java-3.1.6-bin.jar
[Root @ LINUX root] # echo $ PATH
/ Usr / kerberos / sbin: / usr / kerberos / bin: / bin: / sbin: / usr / bin: / usr / sbin: / usr / local / bi
n: / usr / local / sbin: / usr/bin/X11: / usr/java/j2sdk1.4.2_05/bin: / usr/X11R6/bin: / root /
bin
[Root @ LINUX root] # java-version
java version "1.4.2_05"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot (TM) Client VM (build 1.4.2_05-b04, mixed mode)

See a similar message on the jdk environment that has been better. In fact, the above / etc / profile, we not only set the jdk environment variables, also be set up resin and jdbc environment variables, which are necessary for later installation of resin set three, to install the jdbc mysql
# Tar xfz mysql-connector-java-3.1.6.tar.gz
# Mv mysql-standard-4.0.23-pc-linux-i686 / / usr / java / be cut to extract the file / usr / java / directory.
# Cd / usr / java /
# Ln-s mysql-standard-4.0.23-pc-linux-i686 / jdbc create a JDBC connection with the software / usr / java / directory 4, install apache
# Chmod 755 httpd-2.0.52.tar.gz
# Tar xfz httpd-2.0.52.tar.gz
# Cd httpd-2.0.52
Start configuring APACHE

#. / Configure - prefix = / usr/java/httpd2 - enable-module = most - enable-shared = max
This compiled into the apache module:
# / Usr/java/httpd2/bin/httpd-l
[Root @ LINUX root] # / usr/java/httpd2/bin/httpd-l
compiled-in modules:
http_core.c
mod_so.c
See the above information indicates that the apache way of the dso support. This way you can use the php dso modules add to the mix and the resin.

Fifth, install php
We use the PHP version is 4.3.10, first go download: http://www.php.net/downloads.php, under the back of the package called php-4.3.10.tar.gz, into / usr / local / src directory.
First of all unzip into the directory:
# Cd / usr / local / src
# Tar xfz php-4.3.10.tar.gz
Unpacked into the directory:
# Cd php-4.3.10
Configuration, more crucial this step must be set up, in particular, to take into account what you want to support, such as GD library, xml, mysql, etc., if you want to know the details of the configuration, implementation of the. / Configure - help to get:

#. / Configure - with-mysql = / usr / java / mysql - with-apxs = / usr/java/httpd2/bin/apxs

Results above configuration is not wrong, then they should eventually show Thank you for using PHP and so forth, so that the successful configuration, if the above configuration options do not support it, will prompt an error.
For example you do not have to install mysql, then the - with-mysql can not Shiyong, So must pay attention to the possibility of mapping options system support, if error, then the first installation of the corresponding of Cheng Xu, Huozhe remove the related option, configured on compile:

# Make

Compiled after the successful "Build complete." Words, then can be installed:

# Make install

After installation the / usr/local/src/php-4.3.8/php.ini-dist copied to / usr / local / lib /, and rename the php.ini

# Cp / usr/local/src/php-4.3.10/php.ini-dist / usr / local / lib / php.ini

PHP on the installation of basic to success here, and if the middle of an error, except when not in the configuration after the general election of the option is not an error.
In order for Apache to directly resolve php, we need some configuration.
# Vi / usr / java / httpd / conf / httpd.conf
In the httpd.conf file, add

AddType application / x-httpd-php. Php
AddType application / x-httpd-php-source. Phps

More than two sentences should be added after the other AddType.

Ensure that the file has the following sentence, no add on their own after all the LoadModule.

LoadModule php4_module modules/libphp4.so

Well, in vi using ": wq" save the httpd.conf file, quit vi. Start apache server:

# / Usr/java/httpd2/bin/apachectl restart
Now able to run php on apache, and write a paper test, in / usr/java/httpd2/htdocs directory, create a phpinfo.php file
File only one line of code:

<? Phpinfo ();?>;

Save this file in your browser, enter the http://localhost/phpinfo.php, you should see the PHP system information.
If an error occurs, such as prompt you for the next disaster phpinfo.php, then apache is not parsing php files yet, so please double-check the operation of the above is correct.

6. Installation resin
Download the resin after the installation package should be able to directly solve alone run. I will put it after unlock / usr / java / directory
# Tar xfz resin-3.0.10.tar.gz
# Mv resin-3.0.10 / usr / java /
# Cd / usr / java /
# Ln-s resin-3.0.10 / resin
Start resin
# / Usr / java / resin / bin / httpd.sh start
Now we can see from http://localhost:8080/ resin on the page, which also indicated that the resin alone run a success. Then, to integrate resin and apache, what we need to be recompiled to generate mod_caucho call to apache.
# Cd / usr / java / resin
#. / Configure - with-apache = / usr/java/httpd2
# Make
# Make install
Modify / usr / java / resin / conf / resin.conf, about the last (installed resin versions, configuration file contents may vary), will <document-directory>; changes into your apache's documentroot value .

<document-directory>; / usr/java/httpd2/htdocs </ document-directory>; # # here modified to / usr/java/httpd2/htdocs

Finally vi / usr/java/httpd2/conf/httpd.conf
Copy the following
<location /caucho-status>;
sethandler caucho-status
</ Location>;

After saving. APACHE and RESIN from Kai
# / Usr / java / resin / bin / httpd.sh restart
# / Usr/java/httpd2/bin/apachectl restart

Browser to visit http://localhost/caucho-status/, if the following page and apache just said resin has been successfully integrated.
http://www.dfmqp.cn/caucho-status/
7. The establishment of resin and apache virtual host is tes1.jsp.com test2.jsp.com we created two virtual hosts

vi / usr/java/httpd2/conf/httpd.conf
Copy the following contents to the httpd.conf in
NameVirtualHost 192.168.0.1 IP virtual hosts to establish where
<VirtualHost 199.199.0.1>;
DocumentRoot / home/jsp1 / file directory
ServerName tes1.jsp.com domain
</ VirtualHost>;
VirtualHost 192.168.0.1>;
DocumentRoot / home/jsp2 /
ServerName test2.jsp.com
</ VirtualHost>;
vi / usr / java / resin / conf / resin.conf
Find the following code and modify:

<host root-directory=".">;
<! -
- Configures an explicit root web-app matching the
- Webapp's ROOT
->;
<web-app document-directory="/usr/java/httpd2/htdocs"/>;
</ Host>;
<host>;
<web-app document-directory="/home/jsp1"/>;
</ Host>;
<host>;
<web-app document-directory="/home/jsp2"/>;
</ Host>;
Save apache and resin from Kai
tes1.jsp.com and tes2.jsp.com virtual host can run

Can do the following test http://localhost/caucho-status/
You can see the surface of a test
Virtual Host: tes1.jsp.com: 80
Virtual Host: tes2.jsp.com: 80
That the work of normal JSP Web Hosting

相关文章
  • PHP + JSP + MYSQL + APACHE + RESIN Virtual Host Configuration 2010-08-30

    LINUX platform in all configurations are completed and tested successfully complete integration and software as needed resin: http://www.caucho.com/ jdk: http://java.sun.com/ apache: http://www.apache.org mysql: http://www.mysql.com php: http://www.p

  • windows 2003 + apache + php virtual host configuration windows2003serve 2011-03-27

    windows 2003 + apache + php virtual host configuration windows2003serve The method of this article can be found around the web solution, but not very clear, in this order to reduce the users so careless as I take some less roundabout, I wrote the nex

  • Apache Dynamic Virtual Host Configuration 2010-06-29

    Massive presence of dynamic configuration of virtual hosts, the number of WEB sites for the huge amount. Standards provided with the apache module + mod_vhost_aliases dynamically configured hosts. Role is to check the URL to come in after the actual

  • Under Ubuntu Linux apache name-based virtual host configuration 2010-10-12

    Recently in learning linux, linux today to configure a Virtual Host, the following are the steps: To configure the site http://www.myweb.cn Virtual host file myweb 1, the first in / etc/apache2/sites-available directory, create a new empty virtual ho

  • Ubuntu Linux under the apache name-based virtual host configuration 2010-10-12

    Recently in learning linux, linux today to configure a virtual host under, the following are the steps: To configure the site http://www.myweb.cn Virtual host file myweb 1, first in / etc/apache2/sites-available directory create a new empty virtual h

  • apache virtual host configuration 2010-03-17

    1, based on ip address of the virtual host Listen 80 <VirtualHost 172.20.30.40> DocumentRoot / home/httpd/html1 ServerName www.ok1.com ErrorLog / usr/local/apache/logs/error1_log CustomLog / usr/local/apache/logs/access1_log combined </ VirtualHo

  • Apache virtual host configuration steps 2010-11-04

    Apache virtual host configuration steps Open the Apache installation directory under the conf \ httpd.conf Appropriate location at the end add the following configuration directive, modify the relevant settings as needed, detailed instructions explai

  • apache virtual host configuration under windows2003 and binding domain services 2010-11-20

    Years ago to find a friend to apply for a domain name, the work did not get busy, yesterday afternoon, engaged in apache virtual host configuration, tried many times is not, do not know how to engage. This morning finally found why. . . . . . . . . H

  • WordPress Apache virtual host configuration and connection settings fixed 2011-04-15

    A Virtual Host Configuration First, remove the httpd.conf file under the default DocumentRoot and <Directory "XXX"> configuration, add code like the following. <Directory /> Options FollowSymLinks AllowOverride All </Directory>

  • Wan peanut shell dynamic domain name resolution TOMCAT Virtual Host Configuration 2011-08-21

    I. Background Applies to: 1 in million net registered top level domain 2 would like to use their own servers to provide services to 3 is not a static IP. When we million net domain name registration number, we need to set up their own WEB server and

  • The establishment of "JSP + Mysql + Apache Tomcat" Environmental Gonglue 2010-03-29

    The establishment of "JSP + Mysql + Apache Tomcat" Environment Gong Lue: Pre-work that is completed first java environment, which means first installed "JDK" and the "JRE", and set a good environment variable. I am a separato

  • Tomcat virtual host configuration - DNS problem to solve 2010-06-21

    Recently the process of looking at schools with Tomcat virtual host configuration, see the information online is very simple, as long as you can configure what <host>, but no matter how I configure access when this error will appear: After many trou

  • Ubuntu Linux-based domain name under the apache virtual host configuration 2010-05-12

    For example there are two domain www.a.com and www.b.com two domain names resolve to do In / etc/apache2/sites-available directory to establish a and b are two files, here only for ease of use, you look closely you can see the sites-enabled file will

  • Tomcat virtual host configuration method 2010-03-30

    Open the Tomcat installation directory conf / server.xml file, find the line <Engine Name="Catalina" defaultHost=" Your default start domain name "> The line above means that direct access by IP is the default start your domain n

  • javaweb on the tomcat deployment (file mapping the virtual host configuration) 2010-11-29

    1. The main web server software: IIS, Apache, tomcat and so on. 2. Large sites the system topology. 3. Tomcat download: tomcat.Apache.org 4. Tomcat installation: can be directly extracted using the (. Zip), but also be installed using the install (.

  • how to config apache's virtual host 2010-09-16

    Setting up Apache virtual hosts First, IP-based virtual hosts This approach requires setting an IP alias on the machine, like the above example, the network card in a machine to bind multiple IP addresses to service multiple virtual hosts. If the mac

  • [Turn] the use ServerAlias ​​in Apache Setting virtual host name to receive more than one domain name and set the pan Resolution 2011-06-27

    Original Address: http://hi.baidu.com/yhs2006/blog/item/a137fc19e6519775dab4bddb.html serverAlias: server alias in the Apache virtual host can be used to set the receiver to a domain name, you can resolve the domain name for receiving the pan. Specif

  • VirtualHost apache virtual host configuration 2010-04-09

    1: Open the Apache \ conf \ extra \ httpd-vhosts.conf file Add the following domain <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "D: / Apache / htdocs" ServerName www.baidu.com ErrorLog "logs/dummy-host2.localhost-error.

  • Add apache virtual host configuration 2010-03-24

    Set in the httpd.conf in the following <VirtualHost *> <Directory "E:/phpworkspace/granary/app/webroot"> Options-Indexes FollowSymLinks Allow from all AllowOverride All </ Directory> ServerAdmin [email protected] DocumentRo

  • Linux, the LVS, Apache, resin load balancing configuration 2010-08-19

    1. Need to prepare for the hardware and installed software. 192.168.1.128 install LVS virtual server. 192.168.1.126 install an Apache and 3 resin, LVS real server 192.168.1.127 install an Apache and 3 resin, LVS real server 2. 126 on the first instal