tomcat安裝成功后並啟動 ./startup.sh, 訪問 http://ip:8080 ,提示無法訪問
檢查點:
1)檢查\tomcat\conf\web.xml配置,可訪問哪些頁面
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
2)檢查\tomcat\webapps\ROOT下有哪些文件,是否有上述配置里的頁面,若無,則手動添加一個
3)檢查\tomcat\conf\server.xml配置,tomcat設置的是哪個端口
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
4)檢查server.xml配置的端口是否有打開 netstat -an | grep 8080
有的話,則顯示tcp 0 0 :::8080 :::* LISTEN
沒有的話,需要手動開啟 nc -lp 8080 & (此命令來源於網絡,使用時提示nc命令不存在,需要安裝yum install nc --nogpgcheck)
查看端口被什么程序占用 lsof -i:8080
5)檢查防火牆是否允許端口通過 vi /etc/sysconfig/iptables
若不存在當前配置的端口,則需要手動添加 -A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
並重啟防火牆,使之生效 /etc/init.d/iptables restart