怎麼解決tomcat伺服器上80埠問題()
- 第一種解決辦法,更改tomcat安裝目錄下的server.xml檔案,
百度上都是這樣說的,很多人這樣都解決問題了,但是沒能解決我的問題
https://stackoverflow.com/questions/4756039/how-to-change-the-port-of-tomcat-from-8080-to-80
. Edit server.xml and change port="8080" to "80"
sudo vi /var/lib/tomcat7/conf/server.xml <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443
-
第二種方法,在谷歌上查到的(成功解決問題)
https://www.locked.de/how-to-run-tomcat-on-port-80/
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 |
|
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 |
|
Now edit /etc/tomcat7/tomcat7.conf
and set the tomcat user to root:
1 |
|
And restart Tomcat:
1 |
|
- 也有可能是伺服器商的問題 比如:
http://www.weste.net/2017/03-16/114994.html
阿里雲伺服器無法訪問80埠的解決辦法
2017-03-16 10:57:54來源:威易網作者:小威
朋友購買了一臺阿里雲伺服器,配置了半天就是無法從外網訪問到配置的網站,IP直接訪問也不行。讓我幫忙看看。
朋友購買了一臺阿里雲伺服器,配置了半天就是無法從外網訪問到配置的網站,IP直接訪問也不行。讓我幫忙看看。
我首先檢查了一下防火牆,看埠沒並有被禁用。仔細檢查伺服器,埠也沒有衝突。localhost訪問是正常的,這說明只是埠被禁止訪問了。後來登入阿里雲管理控制檯,終於找到了原因。
步驟如下:
1、登入阿里雲的管理控制檯。找到那臺雲伺服器;
2、在操作的部分點選“更多”,裡面藏著一個“安全組配置”;
3、進入“安全組配置”後,點選“配置規則”;
4、然後點選“公網入方向”。預設裡面有22和3389埠是開啟的;
5、點選右上角的“新增安全組規則”;
6、在“新增安全組規則”的對話方塊裡面,新增“埠範圍”為“80/80”,新增“授權物件”為“0.0.0.0/0”,再點選“確定”按鈕。
這樣在訪問伺服器IP,網站就正常顯示了。