5

Linux服务器中配置tomcat的服务,并通过端口8888访问

 1 year ago
source link: https://blog.51cto.com/u_14562672/5849168
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Linux服务器中配置tomcat的服务,并通过端口8888访问

精选 原创

        Tomcat是常见的免费的web服务器,前端服务很多都是通过tomcat部署的!所以多了解点肯定没坏处!

一、配置端口

1.防火墙策略中配置8888端口,并允许策略:

Linux服务器中配置tomcat的服务,并通过端口8888访问_tomcat

二、安装tomcat包

1.新建tomcat文件夹

进入 /usr/local,并新建文件夹

Linux服务器中配置tomcat的服务,并通过端口8888访问_apache_02

mkdir 文件夹名字

2.将apache-tomcat-8.5.82.tar.gz上传到新建文件夹下

Linux服务器中配置tomcat的服务,并通过端口8888访问_tomcat_03

你可以拖拽也可以通过 cp apache-tomcat-8.5.82.tar.gz 指定文件夹 

3.解压tar.gz包

Linux服务器中配置tomcat的服务,并通过端口8888访问_html_04

 4.cd 进入tomcat的conf文件夹下的server.xml

Linux服务器中配置tomcat的服务,并通过端口8888访问_html_05

5.将默认的8080端口服务改为8888端口:

<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8888" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation. The default
SSLImplementation will depend on the presence of the APR/native
library and the useOpenSSL attribute of the AprLifecycleListener.
Either JSSE or OpenSSL style configuration may be used regardless of
the SSLImplementation selected. JSSE style configuration is used below.
-->

如果是配置https服务:在8443 里面  需要换端口的话换,不换的话默认,里面引入ssl证书 !

三、启动tomcat服务

 ​linux服务器中JDK的安装和配置_尔嵘的博客-CSDN博客​​。

1.进入bin

cd bin

2.关闭tomcat 服务

./shutdown.sh

3.启动tomcat服务

./startup.sh

也有用以下命令启动:

catalina run
Linux服务器中配置tomcat的服务,并通过端口8888访问_tomcat_06

四、启动效果:

        默认你的tomcat启动之后,浏览器就可以访问你指定的端口了,效果如下:

Linux服务器中配置tomcat的服务,并通过端口8888访问_tomcat_07

五、其他相关(防火墙相关,端口)

1.启动防火墙

systemctl start firewalld

2.查看防火墙状态 

systemctl status firewalld

3.开放80和8888端口:

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8888/tcp --permanent

4.效果如下,真是服务器效果:

Linux服务器中配置tomcat的服务,并通过端口8888访问_apache_08
  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK