1.
2. # chkconfig: 2345 63 37
3. # description: tomcat server init script
4. # Source Function Library
5. . /etc/init.d/functions
6. JAVA_HOME=/usr/local/jdk1.8.0_31
7. CATALINA_HOME=/usr/local/tomcat
chmod 755 /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on
service tomcat start
ps aux |grep tomcat
浏览器输入 http://ip:8080 可以看到tomcat的欢迎页
配置tomcat
更改默认启动端口:
cd /usr/local/tomcat
vim conf/server.xml
把Connector port=“8080” 改为 Connector port="80"
配置新虚拟主机:
找到</Host>下一行插入新的<Host>内容如下:
<Host name="www.111.com" appBase="/data/tomcatweb"
unpackWARs="false" autoDeploy="true" xmlValidation="false"
xmlNamespaceAware="false">
<Context path="" docBase="./" debug="0" reloadable="true" crossContext="true"/>
</Host>
重启:service tomcat stop; service tomcat start
测试jsp解析
vim /data/tomcatweb/111.jsp //内容如下:
<html><body><center>
Now time is: <%=new java.util.Date()%>
</center></body></html>
curl -xlocalhost:80 www.111.com/111.jsp
看结果是否类似:
<html><body><center>
Now time is: Wed Jan 21 22:33:37 CST 2015
</center></body></html>
原文:http://blog.51cto.com/amazing61/2063907