Server 2012 configure apache+tomcat integration, database mysql, run j2ee project

My task this time is as follows: I bought a new server from Alibaba Cloud and transferred the project to the Alibaba Cloud server.

Alibaba Cloud server system is server2012 64-bit Chinese version, database mysql5.6, because there are multiple sites, it needs apache and tomcat integration, I use ajp simple integration method.

The files are installed on the e-disk,

1. Installation files:

1. Install phpStudy, download address: http://www.phpstudy.net/a.php/208.html, installation directory e:\phpStudy

After installation, the test runs normally, and the default database password is root and the user name is root.

j2, ava operating environment, jdk-7u3-windows-i586:

Configure environment variables, java_home 

Enter java -version on the command line to test the java environment is normal

 

3. Unzip the apache-tomcat-7.0.57-windows-x64 version, run startup.bat in the bin directory, the startup is successful, but an error is reported. The error prompt contains tcnative-1.dll, just delete this file in the bin directory.

 

Two, placement

1. Change mysql to utf8 encoding

Open E:\phpStudy\MySQL\my.ini and change the following two places to utf8

default-character-set=utf8

character-set-server=utf8

restart mysql

 

2, apache configuration

1) Open SSL, phpstudy manages curtains, other options menu - php extension, check php_openssl

2)httpd.conf配置,E:\phpStudy\Apache\conf\httpd.conf

The first step is to remove the comments of these two sentences and load the corresponding module

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_ajp_module modules / mod_proxy_ajp.so

 

The second step is to load the virtual host configuration file, which is the file of the site domain name configuration

# Virtual hosts

Include conf/extra/httpd-vhosts.conf

3) Configure the site domain name

Open this file, E:\phpStudy\Apache\conf\extra\ httpd-vhosts.conf, and add the corresponding site configuration at the end of the file

<!--Integrated with the tomcat site, they are domain names, pay attention to 8039 here, which is the ajp port in tomcat, not the tomcat port-->

  <VirtualHost *:80>

        ServerName *. ***. Com

        ServerAlias ​​*.88888.com

        ProxyPass / ajp://localhost:8039/

        ProxyPassReverse / ajp: // localhost: 8039 /    

     </VirtualHost>

     <!--Configure php site access, phpMyAdmin can access -->

     <VirtualHost *:80>

DocumentRoot "e:\phpStudy\WWW"

ServerName 114.55.115.114

 

</VirtualHost>

Save the configuration and restart apache

 

3. The tomcat configuration, I have explained one of the 8083 ports, the port data must be changed, and all the ports of the tomcat on the server cannot conflict

server.conf path: E:\tomcat\tomcat8083\conf open

1)

<Server port="8035" shutdown="SHUTDOWN">

2) URIEncoding="UTF-8" is added here to solve tomcat garbled characters

  <Connector port="8083" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8433" URIEncoding="UTF-8"/>

3) Configure the ajp port here, URIEncoding="UTF-8" must be increased to solve the garbled ajp jump.

 <!-- Define an AJP 1.3 Connector on port 8009 -->

    <Connector port="8039" protocol="AJP/1.3" redirectPort="8433" URIEncoding="UTF-8" />

 The problem of tomcat garbled characters is that the URIEncoding="UTF-8" added in these two places can be completely solved.

4) Configure the site here

 <Host name="localhost"  appBase="e:\webapps\tomcat8083"

            unpackWARs="true" autoDeploy="true"

            xmlValidation="false" xmlNamespaceAware="false">

          <Context path="" docBase="erp"/>

     </Host>

 

5) Because the server has multiple tomcats, give each a different name after startup, otherwise you don't know which black box is which

Open the file E:\tomcat\tomcat8083\bin\catalina.bat, change the following TITLE, this is the title after tomcat is started

: doStart

shift

if "%TITLE%" == "" set TITLE=Tomcat8083

 

3. Database import

Export first: mysqldump -h 111.112.113.115 -uroot -proot database > database.sql

Import: mysql -uroot -proot 

use database

source database.sql

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326608805&siteId=291194637