Apache Tomcat, MySQL deployment

Source: Internet
Author: User
Tags tomcat server apache tomcat

1, first to download Apache and MySQL

Apach Tomcat official website Download: http://tomcat.apache.org/

MySQL official website: http://dev.mysql.com/downloads/mysql (but you want to download the general registration)

can also use Baidu Software Center download: http://rj.baidu.com/soft/detail/17534.html (note: MySQL here for decompression version)

2, the next can be configured:

Apache Tomcat version: apache-tomcat-7.0.72 (64-bit)

MySQL version: mysql-5.6.24-winx64

Extract: Then look at the configuration of Apache Tomcat first:

"1" Configure the server to run the port:

Find this file in the current directory, Ctrl + F find 8080, that is, set the port number of the server ~

In order to prevent conflict when doing the project, it is generally modified here. If you have to publish the runtime on the server, you need to change it to port 80 ~

The "2" configuration loads the project to run on the server:

First copy the required items to the current directory: (4 A is the JSP page I added)

The import can be a. War, and this can be done with projects that have previously been run (requiring a compiled class) as long as the Webroot part (Eclipse MyEclipse) is copied to WebApps

The next step is to modify the default path, first or earlier, we went to the root directory of the Conf/server.xml

Find this fragment code:

1 <Hostname= "localhost"AppBase= "WebApps"2 Unpackwars= "true"Autodeploy= "true">3 4         <!--Singlesignon valve, share authentication between Web applications5 documentation at:/docs/config/valve.html -6         <!--7 <valve classname= "Org.apache.catalina.authenticator.SingleSignOn"/>8          -9 Ten         <!--Access Log processes all example. One documentation at:/docs/config/valve.html A note:the pattern used is equivalent to using pattern= "common" - -         <ValveClassName= "Org.apache.catalina.valves.AccessLogValve"Directory= "Logs" - prefix= "Localhost_access_log."suffix= ". txt" the pattern= "%h%l%u%t &quot;%r&quot;%s%b" /> -  -       </Host>

Here to put the "AAAA" project sent here: that is, add a statement:

<context Path ="Web application Access Port T" reloadable ="false" docBase = "web App file path" Workdir ="web App working directory" / >

1 <Hostname= "localhost"AppBase= "WebApps"2 Unpackwars= "true"Autodeploy= "true">3             4             <!--Publish file path -5             <ContextDocBase= "C:\Users\Administrator\Desktop\apache-tomcat-7.0.72\webapps\aaaa"Path=""reloadable= "true"/> 6 7         <!--Singlesignon valve, share authentication between Web applications8 documentation at:/docs/config/valve.html -9         <!--Ten <valve classname= "Org.apache.catalina.authenticator.SingleSignOn"/> One          - A  -         <!--Access Log processes all example. - documentation at:/docs/config/valve.html the note:the pattern used is equivalent to using pattern= "common" - -         <ValveClassName= "Org.apache.catalina.valves.AccessLogValve"Directory= "Logs" - prefix= "Localhost_access_log."suffix= ". txt" - pattern= "%h%l%u%t &quot;%r&quot;%s%b" /> +  -       </Host>

Simply explained below:

The <Host> element represents a virtual host, and multiple virtual hosts can be configured under the same <Engine> element


Path: Specifies the URL entry for the Web App


DocBase: Specifies the file path for the Web app, either given an absolute path or a relative path to the AppBase property relative to <Host>.
If the Web app is in an open directory structure, specify the directory for the Web app and, if the Web App is a war file, specify the path to the war file Workdir: Specifies the working directory of the Web App.
Tomcat will be placed in the secondary directory at runtime with the temporary files associated with this web app


Reloadable: If this property is set to True,tomcat server is monitored under web-inf/classes and web-inf/lib directories in the running state
class file, as well as changes to the Web-inf/web.xml file that monitors the Web app.
If a class file is detected to be updated, the server will automatically reload the Web App. The default value for this property is false.
In the development and debugging phase of Web applications, Reloadable is set to true to facilitate debugging of Web applications.
Set Reloadable to False during Web application launch to reduce Tomcat's running load and improve Tomcat performance

Next start the server: in the bin directory, we'll start with the. exe, just look at these 3. bat

Where: Service.bat is a registered service, sometimes the service registration is not successful, you can manually start, or cmd write service start command : net start "Apache Tomcat 7.0 Tomcat7"

Startup.bat is the boot server (do not register the service OH), Shutdown.bat is to shut down the server ~

After starting the server, try: Access successful ~

Next, find the Web. XML in the root conf:

Because my "AAAA" project file is book_list.jsp-Homepage, change the default home page

The bottom of the Web. XML is found:

1 <welcome-file-list>2         <Welcome-file>book_list.jsp</Welcome-file>3         <Welcome-file>Index.html</Welcome-file>4         <Welcome-file>Index.htm</Welcome-file>5         <Welcome-file>index.jsp</Welcome-file>6     </welcome-file-list>

Here Apache Tomcat is configured to finish ~ because book_list.jsp has a connection to the database is only at the end of the demo ~

Configuration of MySQL:

As for the configuration of MySQL is more simple, after decompression to find "My-default.ini" renamed it: "My.ini"

Then open it and edit it: the main or the few,

This modification can:

Where: Basedir is the directory where MySQL datadir for mysql\data, although the directory port is the database port number (usually 3306~)

Then, in cmd, go to MySQL's Bin directory for MySQL installation

After installation, sometimes the service does not start: such as: Can be started here manually, you can continue to append the cmd command:

MySQL will be completed successfully, and later into MySQL can also be:

Creating a Mysql.bat batch, and then every time you enter MySQL is very simple ~

The root password is also very simple:mysqladmin-u username-p Old password password new password

Next, our database fills in the content and accesses the book_list.jsp that were not previously visited: successful access, successful data read ~

Finished ~

Apache Tomcat, MySQL deployment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.