一、tomcat部署调试
Update the package repository
sudo apt-get update
sudo apt-get upgrade --show-upgrades
Install the authbind package
sudo apt-get install authbind
This package allows non-root users to bind to ports below 1024. Install the tomcat7 package
sudo apt-get install tomcat7
The tomcat7-docs, tomcat7-examples,and tomcat7-admin packages aren't required to deploy and maintain a web application. These packages can be skipped unless they are truly needed.
A new user "tomcat7" with primary group "tomcat7" will be created.
Enable authbind
Open a text editor like vim and load the default tomcat configuration file
nano /etc/default/tomcat7
Remove the comment hash "#" in front of the authbind property and set the value to "yes"
AUTHBIND=yes
Create authbind bind permission files for ports 80 and 443. Authbind will loop through the directory structure and try to find a byPort file referencing the port number attempting to be bound. Authorization will be granted if the user attempting to bind has execute permission.
touch /etc/authbind/byport/80
touch /etc/authbind/byport/443
chmod 0755 /etc/authbind/byport/80
chmod 0755 /etc/authbind/byport/443
chown tomcat7:tomcat7 /etc/authbind/byport/80
chown tomcat7:tomcat7 /etc/authbind/byport/443
Change the Tomcat Port from 8080/8443 to 80/443
Open a text editor like vim and load the server configuration file
nano /etc/tomcat7/server.xml
Find the connector for port 8080 to port 80 and the redirect port from 8443 to 443:
<Connector port="80" protocol="HTTP/1.1"
connectiontimeout="20000" uriencoding="UTF-8"
redirectport="443">
</Connector>
Restart the Tomcat service
sudo service tomcat7 restart
View the catalina.out log after restart and look for any errors. If you see permission denied errors, then you may have missed a step like:
Forgetting to uncomment the AuthBind setting and putting it to "yes"
Forgetting to restart the tomcat7 service as sudo
最后运行netstat -ant,查看80端口是否起来 。
二、应用部署
tomcat配置成功后需要将开发的应用部署到tomcat服务器中。步骤如下:
1、将应用打包为ROOT.war
2、在/usr/share/tomcat7中创建logs目录
cd /usr/share/tomcat7
sudo mkdir logs
sudo chmod 755 logs
3、创建ROOT.xml文件内容如下:
<!-- The contents of this file will be loaded for each web application -->
<Context path="" docBase="/usr/share/tomcat7/ROOT.war" displayName="Tomcat_1" reload="false"
debug="0" privileged="true">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
其中 docBase="/usr/share/tomcat7/ROOT.war"指向应用部署所在文件地址。
4、 重启tomcat
sudo service tomcat7 restart
提示信息如下:
* Stopping Tomcat servlet engine tomcat7
...done.
* Starting Tomcat servlet engine tomcat7
...done.
5、启动完毕后登陆应用地址查看。如还不成功请则将ROOT.xml文件拷贝到如下目录中,重复tomcat即可。
/var/lib/tomcat7/conf/Catalina/localhost
分享到:
相关推荐
ubuntu linux下安装tomcat
Ubuntu上Tomcat部署war包失败的解决办法.docx
ubuntu 15.04开放mysql远程3306端口
Ubuntu 12.04 安装配置 Tomcat 7.0.40Tomcat 服务器.docx
该文档介绍了ununtu如何将tomcat注册成系统服务。
需要通过xshell工具,通过ssh连接ubuntu服务器。默认端口22。 结果 常规连接 命令行连接 //直接通过命令连接 ssh 远程机器名@192.168.67.128 或者 telnet 192.168.67.128 22 分析 ip和端口都没有问题。 查看...
Ubuntu虚拟机tomcat服务器搭建与局域网主机互联
ubuntu 16.04安装tomcat 8.0图文详细教程
ubuntu+jdk+tomcat+eclipse 亲自实验 按照步骤操作即可
ubuntu linux 下apache与tomcat的整合.txt
ubuntu 下安装配置tomcat,亲自实践总结的文档,ubuntu版本:ubuntu-10.10-amd64
ubuntu8.04中配置java+tomcat+eclipseMyEclipse开发环境(更新)
ubuntu中部署tomcat
Ubuntu下使用Tomcat搭建网站出现中文乱码的问题.docx
如何在Ubuntu11.10版本配置JDK Tomcat Maven jenkins
root@ubuntu:/etc/apache2# pwd /etc/apache2 root@ubuntu:/etc/apache2# vim ports.conf 8 NameVirtualHost *:81
linux系统下可以实现多个tomcat同时使用,部署多个软件
ubuntu中安装mysql/apache/tomcat/php环境
ubuntu+nginx+tomcat 实现负载匀衡
Ubuntu16集成nginx+多个tomcat+memcached文档.