Ubuntu为Tomcat启用80端口
来源:互联网 发布:圆筒的体积怎么算c语言 编辑:程序博客网 时间:2024/05/22 08:35
一、tomcat部署调试
Update the package repository
sudo apt-get updatesudo 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/80touch /etc/authbind/byport/443chmod 0755 /etc/authbind/byport/80chmod 0755 /etc/authbind/byport/443chown tomcat7:tomcat7 /etc/authbind/byport/80chown 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/tomcat7sudo mkdir logssudo 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.
启动完毕后登陆应用地址查看。如还不成功请参考上述步骤修改。
- Ubuntu为Tomcat启用80端口
- Ubuntu为Tomcat启用80端口
- Ubuntu为Tomcat启用80端口
- ubuntu tomcat启用80和443端口
- Ubuntu 14.04 Web 程序开发(5)Ubuntu为Tomcat启用80端口
- ubutu tomcat 启用80端口步骤
- tomcat 修改端口为80
- ubuntu中tomcat更改80端口(tomcat修改port 为 80 后 无法访问)
- tomcat启用SSL443端口,证书错误问题
- Ubuntu下Tomcat绑定80端口
- Ubuntu下Tomcat绑定80端口
- Ubuntu中将tomcat改为80端口
- 将tomcat端口8080更改为80
- 检测80端口是否启用
- Tomcat启用80/443端口的时候提示“java.net.BindException: Permission denied:80”,怎么解决?
- tomcat启用不同端口,同时启动多个项目
- 搞定ubuntu(11.04~11.10) tomcat绑定80端口
- ubuntu配置tomcat可以远程访问80端口
- 黑马程序员———OC学习第六天(block和协议)
- hdu 2152 Fruit(有上限和下限选择的母函数)
- HTML5 拖放(Drag和drop)
- python 各种解析xml包使用方法总结
- python对XML的解析 SAX DOM ElementTree
- Ubuntu为Tomcat启用80端口
- JavaScript学习笔记(二)------摘自w3school
- 黑马程序员_IO流的总结
- c语言之小括号
- python网络爬虫实践出真知(1)
- sas默认语言修改
- DICOM:fo-dicom之C-STORE再分析‘解决System.ObjectDisposedException异常’
- NDK的用法
- hdu1506一维木板动归