Slowly learn web 1 tomcat configuration

Install JDK and JRE

Environment variables must be configured

JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_131


configure

CATALINA_HOME=E:\apache-tomcat-8.5.24


reboot


Run startup.bat under E:\apache-tomcat-8.5.24\bin to start the server




run successfully

into 127.0.0.1:8080



Configuration succeeded! !



Call shutdown.bat to shut down the server

Then implement the configuration in tomcat. You can configure the port number and so on in conf/server.xml.

Commonly used in elements

1

<Connector port="8080"

Modify it to 80 and use port 80 to access by default.


2 web root directory and app directory.

In the default configuration only appBase represents the application directory. An application directory may contain multiple applications. If no configuration is performed, the ROOT directory application under the appBase directory is selected by default.

<Host name="localhost"  appBase="webapps"

If you want to specify which application directory. Must add <Context tag>

<Context path="/foobar" docBase="C:\path\to\application\foobar">
</Context>

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

Among them, path represents the path of web access, and docBase represents the directory where the application document exists. 

上面 path="/"  docBase="/foobar" appBase="webapps"

Then when the webpage accesses 127.0.0.1:8080/, it is the accessed webapps/foobar

if 

<Context path="/xxxqq" docBase="/foobarxxx "></Context> appBase="myroot"

Then when the webpage accesses 127.0.0.1:8080/xxxqq, it is myroot / foobarxxx accessed

http://blog.csdn.net/qq_33189295/article/details/50513935

http://blog.csdn.net/chenxiaodan_danny/article/details/45397765


3Configure the pages accessed by default 

in conf/web.xml


    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

How to configure you know


Then run it again with startup.bat


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326064079&siteId=291194637