I want to execute my web app as http://localhost
.
我想将我的web应用程序作为http://localhost执行。
15 个解决方案
#1
204
1) Go to conf
folder in tomcat installation directory
1)到tomcat安装目录中的conf文件夹。
e.g. C:\Tomcat 6.0\conf\
2) Edit following tag in server.xml
file
2)在服务器上编辑以下标签。xml文件
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
3) Change the port=8080
value to port=80
3)将端口=8080的值改为端口=80。
4) Save file.
4)保存文件。
5) Stop your Tomcat and restart it.
5)停止Tomcat并重新启动它。
#2
104
On a Linux Debian-based (so Ubuntu included) you have also to go to /etc/default/tomcat7
, uncomment the #AUTHBIND=no
line and set its value to 'yes', in order to let the server bind on a privileged port.
在基于Linux的debian(包括Ubuntu)中,您还需要访问/etc/default/tomcat7,取消#AUTHBIND=no行,并将其值设置为“yes”,以便让服务器绑定到特权端口。
#3
102
Ubuntu 14.04 LTS, in Amazon EC2. The following steps resolved this issue for me:
ubuntu14.04 LTS,在Amazon EC2上。以下步骤为我解决了这个问题:
1. Edit server.xml and change port="8080" to "80"
1。编辑服务器。xml和更改端口="8080"到"80"
sudo vi /var/lib/tomcat7/conf/server.xml
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
2. Edit tomcat7 file
2。编辑tomcat7文件
sudo vi /etc/default/tomcat7
uncomment and change #AUTHBIND=no to yes
取消注释和更改#AUTHBIND=不可以。
3. Install authbind
3所示。安装authbind
sudo apt-get install authbind
4. Run the following commands to provide tomcat7 read+execute on port 80.
4所示。运行以下命令提供tomcat7 read+在端口80上执行。
sudo touch /etc/authbind/byport/80
sudo chmod 500 /etc/authbind/byport/80
sudo chown tomcat7 /etc/authbind/byport/80
5. Restart tomcat:
5。重启tomcat:
sudo /etc/init.d/tomcat7 restart
#4
27
On Ubuntu and Debian systems, there are several steps needed:
在Ubuntu和Debian系统中,需要几个步骤:
-
In server.xml, change the line
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
to haveport="80"
.在服务器上。xml,更改行
有端口="80"。 -
Install the recommended (not required) authbind package, with a command like:
安装推荐的(不需要)authbind包,使用如下命令:
sudo apt-get install authbind
sudo apt-get安装authbind
-
Enable authbind in the server.xml file (in either
/etc/tomcat6
or/etc/tomcat7
) by uncommenting and setting the line like:在服务器中启用authbind。xml文件(在/etc/tomcat6或/etc/tomcat7中)通过取消注释并设置如下:
AUTHBIND=yes
AUTHBIND = yes
All three steps are needed.
这三个步骤都是需要的。
#5
21
I tried changing the port from 8080
to 80
in the server.xml
but it didn't work for me. Then I found alternative, update the iptables
which i'm sure there is an impact on performance.
我尝试在服务器上从8080到80更改端口。xml,但对我没用。然后我找到了另一种方法,更新iptables,我确信它会对性能产生影响。
I use the following commands:
我使用以下命令:
sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo /sbin/service iptables save
http://www.excelsior-usa.com/articles/tomcat-amazon-ec2-advanced.html#port80
http://www.excelsior-usa.com/articles/tomcat-amazon-ec2-advanced.html port80
#6
15
As previous answers didn't work well (it was good, but not enough) for me on a 14.04 Ubuntu Server, I mention these recommendations (this is a quote).
由于之前的回答不太好(这很好,但还不够),在14.04 Ubuntu服务器上,我提到了这些建议(这是引用)。
Edit: note that as @jason-faust mentioned it in the comments, on 14.04, the authbind
package that ships with it does support IPv6 now, so the prefer IPv4 thing isn't needed any longer.
编辑:请注意,正如@ jasonfaust在评论中提到的,在14.04中,与它一起使用的authbind包现在支持IPv6,所以更喜欢IPv4的东西不再需要了。
1) Install authbind
2) Make port 80 available to authbind (you need to be root):
touch /etc/authbind/byport/80
chmod 500 /etc/authbind/byport/80
chown tomcat7 /etc/authbind/byport/80
3) Make IPv4 the default (authbind does not currently support IPv6).
To do so, create the file TOMCAT/bin/setenv.sh with the following content:
CATALINA_OPTS="-Djava.net.preferIPv4Stack=true"
4) Change /usr/share/tomcat7/bin/startup.sh
exec authbind --deep "$PRGDIR"/"$EXECUTABLE" start "$@"
# OLD: exec "$PRGDIR"/"$EXECUTABLE" start "$@"
If you already got a setenv.sh
file in /usr/share/tomcat7/bin
with CATALINA_OPTS
, you have to use :
如果你已经有一个setenv。在/usr/share/tomcat7/bin和CATALINA_OPTS的文件中,你必须使用:
export CATALINA_OPTS="$CATALINA_OPTS -Djava.net.preferIPv4Stack=true"
Now you can change the port to 80
as told in other answers.
现在您可以将端口更改为80,就像在其他答案中所告诉的那样。
#7
6
On modern linux the best approach (for me) is to use xinetd :
在现代linux中,最好的方法是使用xinetd:
1) create /etc/xinet.d/tomcat-http
1)创建/etc/xinet.d/tomcat-http
service http
{
disable = no
socket_type = stream
user = root
wait = no
redirect = 127.0.0.1 8080
}
2) create /etc/xinet.d/tomcat-https
2)创建/etc/xinet.d/tomcat-https
service https
{
disable = no
socket_type = stream
user = root
wait = no
redirect = 127.0.0.1 8443
}
3) chkconfig xinetd on
3)chkconfig xinetd
4) /etc/init.d/xinetd start
4)/etc/init.d / xinetd启动
#8
5
If someone is looking for, how to change the tomcat port number in Eclipse IDE user following are the steps.
如果有人正在寻找,如何在Eclipse IDE用户中更改tomcat端口号是步骤。
1.In the Servers view, double click on the server name:
1。在Servers视图中,双击服务器名称:
2.That will open a configuration page for Tomcat as follows:
2。这将为Tomcat打开一个配置页面,如下所示:
3.Notice the port numbers are shown in the table on the right. Click to edit, for example:
3所示。注意端口号在右边的表中显示。点击编辑,例如:
4.That will change port number for HTTP from 8080 to 80. Press Ctrl + S to save the change and restart the server. We can spot the change of port number in the Console view:
4所示。这将更改HTTP的端口号,从8080到80。按Ctrl + S保存更改并重新启动服务器。我们可以在Console视图中发现端口号的更改:
This all content were taken from below link, please refer that link for further information thanks. http://www.codejava.net/servers/tomcat/how-to-change-port-numbers-for-tomcat-in-eclipse
所有内容都是从下面的链接中获取的,请参考链接以获得进一步的信息谢谢。http://www.codejava.net/servers/tomcat/how-to-change-port-numbers-for-tomcat-in-eclipse
#9
4
Running the command below worked with. Tried changing server.xml and the conf file but both didn't work.
运行下面的命令。试着改变服务器。xml和conf文件,但都不起作用。
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
/sbin/iptables -一个输入-i - eth0 -p tcp -dport 80 -j接受。
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
/sbin/iptables -一个输入-i - eth0 -p tcp -dport 8080 -j接受。
/sbin/iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
/sbin/iptables -- -t nat -i - eth0 -p tcp -dport 80 -j重定向到端口8080。
#10
3
1) Locate server.xml in {Tomcat installation folder}\ conf \
2) Find following similar statement
1)定位服务器。在{Tomcat安装文件夹}\ conf \ 2)中发现以下类似的语句。
<!-- Define a non-SSL HTTP/1.1 Connector on port 8180 -->
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
3)now change port="---"(what ever you want)
现在更改端口="---"(你想要什么)
#11
2
if you are using eclipse and modifying server.xml doesn't work for you then try following article.. they have steps to modify port if you are using IDE like eclipse.
如果您正在使用eclipse和修改服务器。xml对您不起作用,然后尝试下一篇文章。如果您使用的是eclipse之类的IDE,那么它们就有了修改端口的步骤。
#12
1
Just goto conf folder of tomcat
只需要goto conf文件夹的tomcat。
open the server.xml file
打开服务器。xml文件
Goto one of the connector node which look like the following
下面是一个连接器节点。
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Simply change the port
简单地改变港口
save and restart tomcat
保存并重启tomcat
#13
1
Here are the steps:
下面是步骤:
--> Follow the path: {tomcat directory>/conf -->Find this line:
——>遵循路径:{tomcat目录>/conf ->找到这条线:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
change portnumber from "8080" to "80".
将portnumber从“8080”改为“80”。
--> Save the file.
- - >保存文件。
--> Restart the server :)
——>重新启动服务器:)
#14
1
On a linux server you can just use this commands to reconfigure Tomcat to listen on port 80:
在linux服务器上,您可以使用以下命令重新配置Tomcat来监听端口80:
sed -i 's|port="8080"|port="80"|g' /etc/tomcat?/server.xml
sed -i 's|#AUTHBIND=no|AUTHBIND=yes|g' /etc/default/tomcat?
service tomcat8 restart
#15
0
Don't forget to edit the file. Open file /etc/default/tomcat7
and change
别忘了编辑文件。打开文件/etc/default/tomcat7并更改。
#AUTHBIND=no
to
来
AUTHBIND=yes
then restart.
然后重启。
#1
204
1) Go to conf
folder in tomcat installation directory
1)到tomcat安装目录中的conf文件夹。
e.g. C:\Tomcat 6.0\conf\
2) Edit following tag in server.xml
file
2)在服务器上编辑以下标签。xml文件
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
3) Change the port=8080
value to port=80
3)将端口=8080的值改为端口=80。
4) Save file.
4)保存文件。
5) Stop your Tomcat and restart it.
5)停止Tomcat并重新启动它。
#2
104
On a Linux Debian-based (so Ubuntu included) you have also to go to /etc/default/tomcat7
, uncomment the #AUTHBIND=no
line and set its value to 'yes', in order to let the server bind on a privileged port.
在基于Linux的debian(包括Ubuntu)中,您还需要访问/etc/default/tomcat7,取消#AUTHBIND=no行,并将其值设置为“yes”,以便让服务器绑定到特权端口。
#3
102
Ubuntu 14.04 LTS, in Amazon EC2. The following steps resolved this issue for me:
ubuntu14.04 LTS,在Amazon EC2上。以下步骤为我解决了这个问题:
1. Edit server.xml and change port="8080" to "80"
1。编辑服务器。xml和更改端口="8080"到"80"
sudo vi /var/lib/tomcat7/conf/server.xml
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
2. Edit tomcat7 file
2。编辑tomcat7文件
sudo vi /etc/default/tomcat7
uncomment and change #AUTHBIND=no to yes
取消注释和更改#AUTHBIND=不可以。
3. Install authbind
3所示。安装authbind
sudo apt-get install authbind
4. Run the following commands to provide tomcat7 read+execute on port 80.
4所示。运行以下命令提供tomcat7 read+在端口80上执行。
sudo touch /etc/authbind/byport/80
sudo chmod 500 /etc/authbind/byport/80
sudo chown tomcat7 /etc/authbind/byport/80
5. Restart tomcat:
5。重启tomcat:
sudo /etc/init.d/tomcat7 restart
#4
27
On Ubuntu and Debian systems, there are several steps needed:
在Ubuntu和Debian系统中,需要几个步骤:
-
In server.xml, change the line
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
to haveport="80"
.在服务器上。xml,更改行
有端口="80"。 -
Install the recommended (not required) authbind package, with a command like:
安装推荐的(不需要)authbind包,使用如下命令:
sudo apt-get install authbind
sudo apt-get安装authbind
-
Enable authbind in the server.xml file (in either
/etc/tomcat6
or/etc/tomcat7
) by uncommenting and setting the line like:在服务器中启用authbind。xml文件(在/etc/tomcat6或/etc/tomcat7中)通过取消注释并设置如下:
AUTHBIND=yes
AUTHBIND = yes
All three steps are needed.
这三个步骤都是需要的。
#5
21
I tried changing the port from 8080
to 80
in the server.xml
but it didn't work for me. Then I found alternative, update the iptables
which i'm sure there is an impact on performance.
我尝试在服务器上从8080到80更改端口。xml,但对我没用。然后我找到了另一种方法,更新iptables,我确信它会对性能产生影响。
I use the following commands:
我使用以下命令:
sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo /sbin/service iptables save
http://www.excelsior-usa.com/articles/tomcat-amazon-ec2-advanced.html#port80
http://www.excelsior-usa.com/articles/tomcat-amazon-ec2-advanced.html port80
#6
15
As previous answers didn't work well (it was good, but not enough) for me on a 14.04 Ubuntu Server, I mention these recommendations (this is a quote).
由于之前的回答不太好(这很好,但还不够),在14.04 Ubuntu服务器上,我提到了这些建议(这是引用)。
Edit: note that as @jason-faust mentioned it in the comments, on 14.04, the authbind
package that ships with it does support IPv6 now, so the prefer IPv4 thing isn't needed any longer.
编辑:请注意,正如@ jasonfaust在评论中提到的,在14.04中,与它一起使用的authbind包现在支持IPv6,所以更喜欢IPv4的东西不再需要了。
1) Install authbind
2) Make port 80 available to authbind (you need to be root):
touch /etc/authbind/byport/80
chmod 500 /etc/authbind/byport/80
chown tomcat7 /etc/authbind/byport/80
3) Make IPv4 the default (authbind does not currently support IPv6).
To do so, create the file TOMCAT/bin/setenv.sh with the following content:
CATALINA_OPTS="-Djava.net.preferIPv4Stack=true"
4) Change /usr/share/tomcat7/bin/startup.sh
exec authbind --deep "$PRGDIR"/"$EXECUTABLE" start "$@"
# OLD: exec "$PRGDIR"/"$EXECUTABLE" start "$@"
If you already got a setenv.sh
file in /usr/share/tomcat7/bin
with CATALINA_OPTS
, you have to use :
如果你已经有一个setenv。在/usr/share/tomcat7/bin和CATALINA_OPTS的文件中,你必须使用:
export CATALINA_OPTS="$CATALINA_OPTS -Djava.net.preferIPv4Stack=true"
Now you can change the port to 80
as told in other answers.
现在您可以将端口更改为80,就像在其他答案中所告诉的那样。
#7
6
On modern linux the best approach (for me) is to use xinetd :
在现代linux中,最好的方法是使用xinetd:
1) create /etc/xinet.d/tomcat-http
1)创建/etc/xinet.d/tomcat-http
service http
{
disable = no
socket_type = stream
user = root
wait = no
redirect = 127.0.0.1 8080
}
2) create /etc/xinet.d/tomcat-https
2)创建/etc/xinet.d/tomcat-https
service https
{
disable = no
socket_type = stream
user = root
wait = no
redirect = 127.0.0.1 8443
}
3) chkconfig xinetd on
3)chkconfig xinetd
4) /etc/init.d/xinetd start
4)/etc/init.d / xinetd启动
#8
5
If someone is looking for, how to change the tomcat port number in Eclipse IDE user following are the steps.
如果有人正在寻找,如何在Eclipse IDE用户中更改tomcat端口号是步骤。
1.In the Servers view, double click on the server name:
1。在Servers视图中,双击服务器名称:
2.That will open a configuration page for Tomcat as follows:
2。这将为Tomcat打开一个配置页面,如下所示:
3.Notice the port numbers are shown in the table on the right. Click to edit, for example:
3所示。注意端口号在右边的表中显示。点击编辑,例如:
4.That will change port number for HTTP from 8080 to 80. Press Ctrl + S to save the change and restart the server. We can spot the change of port number in the Console view:
4所示。这将更改HTTP的端口号,从8080到80。按Ctrl + S保存更改并重新启动服务器。我们可以在Console视图中发现端口号的更改:
This all content were taken from below link, please refer that link for further information thanks. http://www.codejava.net/servers/tomcat/how-to-change-port-numbers-for-tomcat-in-eclipse
所有内容都是从下面的链接中获取的,请参考链接以获得进一步的信息谢谢。http://www.codejava.net/servers/tomcat/how-to-change-port-numbers-for-tomcat-in-eclipse
#9
4
Running the command below worked with. Tried changing server.xml and the conf file but both didn't work.
运行下面的命令。试着改变服务器。xml和conf文件,但都不起作用。
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
/sbin/iptables -一个输入-i - eth0 -p tcp -dport 80 -j接受。
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
/sbin/iptables -一个输入-i - eth0 -p tcp -dport 8080 -j接受。
/sbin/iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
/sbin/iptables -- -t nat -i - eth0 -p tcp -dport 80 -j重定向到端口8080。
#10
3
1) Locate server.xml in {Tomcat installation folder}\ conf \
2) Find following similar statement
1)定位服务器。在{Tomcat安装文件夹}\ conf \ 2)中发现以下类似的语句。
<!-- Define a non-SSL HTTP/1.1 Connector on port 8180 -->
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
3)now change port="---"(what ever you want)
现在更改端口="---"(你想要什么)
#11
2
if you are using eclipse and modifying server.xml doesn't work for you then try following article.. they have steps to modify port if you are using IDE like eclipse.
如果您正在使用eclipse和修改服务器。xml对您不起作用,然后尝试下一篇文章。如果您使用的是eclipse之类的IDE,那么它们就有了修改端口的步骤。
#12
1
Just goto conf folder of tomcat
只需要goto conf文件夹的tomcat。
open the server.xml file
打开服务器。xml文件
Goto one of the connector node which look like the following
下面是一个连接器节点。
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Simply change the port
简单地改变港口
save and restart tomcat
保存并重启tomcat
#13
1
Here are the steps:
下面是步骤:
--> Follow the path: {tomcat directory>/conf -->Find this line:
——>遵循路径:{tomcat目录>/conf ->找到这条线:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
change portnumber from "8080" to "80".
将portnumber从“8080”改为“80”。
--> Save the file.
- - >保存文件。
--> Restart the server :)
——>重新启动服务器:)
#14
1
On a linux server you can just use this commands to reconfigure Tomcat to listen on port 80:
在linux服务器上,您可以使用以下命令重新配置Tomcat来监听端口80:
sed -i 's|port="8080"|port="80"|g' /etc/tomcat?/server.xml
sed -i 's|#AUTHBIND=no|AUTHBIND=yes|g' /etc/default/tomcat?
service tomcat8 restart
#15
0
Don't forget to edit the file. Open file /etc/default/tomcat7
and change
别忘了编辑文件。打开文件/etc/default/tomcat7并更改。
#AUTHBIND=no
to
来
AUTHBIND=yes
then restart.
然后重启。