tomcat配置路上踩过坑(windows版本)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_25735003/article/details/89277677

1.下载tomcat(由于是window版本,所以)

 个人建议直接下载exe文件,天命安装法,直接安在window上,快捷方便。

2.配置安装信息

配置用户名字,我们到tomcat的安装目录下:C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf(由于我是采用默认路径,所以路径是这样,可能每个人的路径不一样)

首先是配置tomcat-server.xml,在</tomcat-users>前加入下面的用户信息

<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui" />

同级目录下打开 server.xml(修改端口和默认主页)

 <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

 //如果要采用不一样的端口号,可以将8080修改,例如修改为80端口

<Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

若要修改默认主页则在 <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">下加入一行

<Context path="" docBase="你的项目路径" debug="0"/>

主页一般命名为index.html若不是则需要在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>

将这一段改为你的主页信息,例如主页为login.html,则

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

 配置过程中若出现无法启动,可以在logs(与web apps同级)目录下的txt文档中查看日志信息。

猜你喜欢

转载自blog.csdn.net/qq_25735003/article/details/89277677