In fact, almost under Linux configuration under Tomcat server and Windows, you can go to the official website to download the installation package released or online download, but was windows.zip downloaded files, you can now download .tar.gz format, use the following command line mode installation
Good to be released after download
tar -xzvf apache-tomcat-8.0.30.tar.gz
After the release can delete the original package, into the server directory, now no problem you can start tomcat, and into the next bin, execute the script startup.sh
./startup.sh
Then see this has already started, if the DNS server to before, and port 80 is bound, so do not run directly binding domain devoted to http: // servername: 8080 / you can see the following interface:
Stop server can use ./shutdown.sh to carry out, and now it is the most basic configuration tomcat good
The following configuration tomcat application directory server, application default directory is tomcat webapps case, we can modify the specified directory
First to enter the conf directory server, execute vim server.xml open files found <Host name = "localhost" appBase = "webapps" unpackWARs = "true" autoDeploy = "true"> this code, change the value of our appBase the directory can be their own definition
现在,重新启动服务器就可以生效了,现在访问刚才的地址会发现是空白,是因为没有配置默认项目的原因,tomcat服务器的默认项目是webapps下的ROOT目录,就是说访问的时候可以去除项目名称,直接当做根目录使用,而其他目录则必须使用http://servername:8080/projectname/进行访问,现在我们第一种方法就是适应tomcat服务器的默认项目,在我们的应用目录下建立ROOT目录,这样很好理解,另外一种方法就是我们自定义默认项目目录,方法如下
还是用vim打开conf/server.xml文件,定位到刚才的<Host>标签位置,然后在<Host></Host>标签中间,或者是</Host>结束标签之间添加以下代码配置:
<Context path="" docBase="自定义的默认项目路径" debug="0" reloadable="true" />
path=""代表的就是应用目录下的直接目录,docBase就是默认项目目录,后面的reloadable就是默认自动编译源文件为class文件,便于调试,生产环境中可以设为false,从而提高tomcat服务器的性能