本文介绍了无法在centOS VPS上访问tomcat服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有VPS(虚拟专用服务器).并且我想在此服务器上安装apache-tomcat.服务器的操作系统是CentOS 64位.我通过下面的步骤进行安装.

I got VPS (Virtual Private Server). and I want to install apache-tomcat with this server. the server's OS is CentOS 64bit. I installed through beneath steps.

第1步.安装JDK

    cd /usr/tmp
    wget http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.rpm
    rpm -Uvh jdk-8u51-linux-x64.rpm

第2步.安装Tomcat

wget http://apache.tt.co.kr/tomcat/tomcat-8/v8.0.24/bin/apache-tomcat-8.0.24.tar.gz
tar xvfpz apache-tomcat-8.0.24.tar.gz
mv apache-tomcat-8.0.24 /usr/local/tomcat

第3步.添加tomcat服务在shell代码下编写并保存到/etc/rc.d/init.d/并通过"chmod 755/etc/rc.d/init.d/tomcat"更改权限

Step 3. Adding tomcat servicewrote beneath shell code and save into /etc/rc.d/init.d/and change permission by 'chmod 755 /etc/rc.d/init.d/tomcat'

#!/bin/sh
# Startup script for Tomcat
#
# chkconfig: 35 85 15
# description: apache tomcat 6.x
#
# processname: tomcat
#
# Source function library.
export JAVA_HOME=/usr/java/default
export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
# See how we were called.
case "$1" in
start)
echo -n "Starting tomcat: "
$CATALINA_HOME/bin/catalina.sh start
echo
;;
stop)
echo -n "Shutting down tomcat: "
$CATALINA_HOME/bin/catalina.sh stop
echo
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0

第4步.运行服务

chkconfig –add tomcat
service tomcat start

但是...我在 server:8080 上看不到 cat...所以我发现一些文件说在iptables上打开8080端口.所以我加了这个报价

But... I couldn't see cat on server:8080...So I found some document saying open 8080 port on iptables.so I adding this quote

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

但是事情没有改变.仍然无法从外部访问此服务器.即使我停止iptables,iptables6也无法访问.

But things not changed. still I can't access this server at externally.Even if I stop iptables, iptables6, Can't acess.

Server IP : 168.92.122.39   Domain : 39.vs.woobi.co.kr
FTP 182.162.94.35:53921 -> 192.168.122.39:21
SSH 182.162.94.35:53922 -> 192.168.122.39:22
MYSQL 182.162.94.35:53906 -> 192.168.122.39:3306

我不知道这是什么问题.我花了很多时间.请帮助我!

I don't know what is problem. I spend so many time with this. please help me!

推荐答案

请尝试使用 firewall-cmd 命令(CentOS 7),而不要使用您指定的 iptables 命令.或 lokkit (CentOS 6)

Instead of using the iptables command you specified, try the firewall-cmd command (CentOS 7) or lokkit (CentOS 6)

# CentOS 6
lokkit -p 8080:tcp

# CentOS 7
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload

还请检查您的VPS提供商的文档.可能您也必须在其用户界面中打开/转发端口.例如,我知道亚马逊需要这样做.

Also check the documentation of your VPS provider. It may be that you must open/forward the port in their user interface as well. I know for example that Amazon requires this.

这篇关于无法在centOS VPS上访问tomcat服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 11:40