Run tomcat on port 80 not 8080
How to run Tomcat on Port 80
A standard Tomcat installation starts the webserver on port 8080 – which is usually not the desired behavior. In order to change the server to port 80 there are two options which I outline in the following:
Recommended: redirect traffic to 8080
Tomcat continues to listen on port 8080 (and 8443 for https). The traffic is redirected by iptables.
You don’t need to change anything in Tomcat itself, just add according
Iptables-Forwarding rules. Actually this looks more complicated than the
alternative – but it is the more secure way and you do not need to
touch Tomcat’s config.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# check that rules are not there alreadysudo iptables -L -n -t nat# Add rulessudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443# Checksudo iptables -L -n -t nat# Savesudo /service iptables save# Restart iptablessudo /etc/init.diptables restart# final checksudo iptables -L -n -t nat |
Option2: run Tomcat directly on port 80
This configures to run Tomcat directly on port 80. As this is a
priviledged port, Tomcat must run as root – this is usually not
recommended.
The advantage: It’s simple!
The disadvantage: A webserver shouldn’t run as root.If you want to do this nevertheless, edit /etc/tomcat7/server.xml and change the connector port from 8080 to just 80:
|
1
2
3
4
|
<Connector port="<del>80</del>80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> |
Now edit /etc/tomcat7/tomcat7.conf and set the tomcat user to root:
|
1
|
TOMCAT_USER="root" |
And restart Tomcat:
|
1
|
sudo service tomcat7 restart |
REF:
https://www.locked.de/how-to-run-tomcat-on-port-80/
Run tomcat on port 80 not 8080的更多相关文章
- 关于设置tomcat端口为80的事
今天有人要求tomcat服务器的访问地址不能带端口访问, 也就是说只能用80端口访问网站. 那么问题来了, Ubuntu系统禁止root用户以外的用户访问1024以下的商品, 因此tomcat 默认为 ...
- How to run Tomcat without root privileges? 常规用户使用tomcat的80端口
How to run Tomcat without root privileges? 1. The best way is to use jsvc, available as part of the ...
- Linux Tomcat 80端口 Port 80 required by Tomcat v8.5 Server at localhost is already in use.
Port 80 required by Tomcat v8.5 Server at localhost is already in use. The server may already be run ...
- tomcat 大并发报错 Maximum number of threads (200) created for connector with address null and port 80
1.INFO: Maximum number of threads (200) created for connector with address null and port 80 说明:最大线程数 ...
- tomcat、Apache服务器外网无法访问80和8080端口,其他端口可以访问
tomcat.Apache服务器外网无法访问80和8080端口,其他端口都可以访问,很明显地看出这是网络运营商的问题,他们把80和8080端口对外访问屏蔽了. 解释:这两个端口是常用的HTTP协议端口 ...
- 解决 Tomcat 无法绑定 80 端口的问题,以及 Tomcat 配置虚拟目录、二级域名等
问题 今天安装完 Tomcat,安装时把 Tomcat 默认的 HTTP/1.1 Connector Port 从 8080 改为了 7080,启动 Tomcat,在浏览器中输入 Http://loc ...
- iis实现类似tomcat ip:port直接访问站点
先配置host: 建站点: iis配置文件地址:C:\Windows\System32\inetsrv\config\applicationHost.config(于tomcat中的web.xml类似 ...
- Tomcat介绍、安装jdk、安装Tomcat、配置Tomcat监听80端口
1.Tomcat介绍 2.安装jdk下载:wget -c http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8 ...
- 配置Tomcat监听80端口、配置Tomcat虚拟主机、Tomcat日志
6月27日任务 16.4 配置Tomcat监听80端口16.5/16.6/16.7 配置Tomcat虚拟主机16.8 Tomcat日志扩展邱李的tomcat文档 https://www.linuser ...
随机推荐
- 二 js表达式与运算符
/** * Created by Administrator on 2017/12/14. * 表达式与运算符 */ //1.基本表达式 加减乘除 var a = 4; a = 7/6; var b ...
- 使用js Math.random()函数生成n到m间的随机数字
何使用js生成n到m间的随机数字,主要目的是为后期的js生成验证码做准备,Math.random()函数返回0和1之间的伪随机数 摘要: 本文讲解如何使用js生成n到m间的随机数字,主要目的是为后 ...
- 设置一个div网页滚动时,使其固定在头部,当页面滚动到距离头部300px时,隐藏该div,另一个div在底部,此时显示;当页面滚动到起始位置时,头部div出现,底部div隐藏
设置一个div网页滚动时,使其固定在头部,当页面滚动到距离头部300px时,隐藏该div,另一个div在底部,此时显示: 当页面滚动到起始位置时,头部div出现,底部div隐藏 前端代码: <! ...
- Rpgmakermv(7) Chronus插件介绍翻译
协议:MIT 作用:时间,有时间推进,可以设置速度,随着游戏中时间的推进,会发生昼夜改变和天气变化. ------------------------------------------------- ...
- jQuery选择器--:first和:last
:first 概述 获取匹配的第一个元素 :last 概述 获取匹配的最后个元素 <!DOCTYPE html> <html> <head> <m ...
- 20155228 实验二 Java面向对象程序设计
20155228 实验二 Java面向对象程序设计 实验内容 1. 初步掌握单元测试和TDD 2. 理解并掌握面向对象三要素:封装.继承.多态 3. 初步掌握UML建模 4. 熟悉S.O.L.I.D原 ...
- Python OS模块常用功能 中文图文详解
一.Python OS模块介绍 OS模块简单的来说它是一个Python的系统编程的操作模块,可以处理文件和目录这些我们日常手动需要做的操作. 可以查看OS模块的帮助文档: >>> i ...
- Second LearningConvolutionalNeuralNetworksforGraphs Experience
paper +ppt 链接:https://pan.baidu.com/s/1ZLBvv7mP8OoseQ4tnwhr_A 提取码:4amg
- 转:C# 小数位数保留的方法集锦
转载自:http://www.jb51.net/article/17010.htm 1. System.Globalization.NumberFormatInfo provider = new Sy ...
- js中利用cookie实现记住密码功能
在登录界面添加记住密码功能,代码如下: //设置cookie var passKey = '4c05c54d952b11e691d76c0b843ea7f9'; function setCookie( ...