- Print
- PDF
Tomcat
- Print
- PDF
Available in Classic and VPC
Tomcat is a web application server and servlet container platform utilizing Tomcat while using Linux as an OS. It is automatically configured on NAVER Cloud Platform's Compute infrastructure service and can be instantly put into service through a configuration process with only a few steps.
The advantages of using Tomcat are as follows:
- You can reliably use Tomcat utilizing the infrastructure services of NAVER Cloud Platform.
- You can select a server image and specifications to automatically install and use the Tomcat server.
For more information on the software used in NAVER Cloud Platform's Tomcat, see the following websites:
Creating and accessing server
The method for creating and accessing the server is the same as creating a regular server on NAVER Cloud Platform. The following are detailed procedures and reference guides:
Procedure | Description |
---|---|
1. Set ACG |
|
2. Create server |
|
3. Set public IP |
|
4. Set port forwarding (Classic only) |
|
5. Get admin password |
|
6. Access server |
|
- After you access and log in to the server, change the password of the root account to one you can remember. Enter the
passwd root
command to set a new password. - If you can't connect to the Tomcat Web service even if there is no problem in the public IP address and ACG, your web server process might be stopped. Run the restart command (
systemctl start httpd
) on the terminal program to restart the process.
Using server
When the server is created, the Tomcat web application server is installed for easy use.
While connected to the server, you can run the following commands:
- Stop service:
systemctl stop tomcat
- Run service:
systemctl start tomcat
- Check service status
[root@tomcat-c73 ~]# systemctl status tomcat ● tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2022-10-05 13:11:14 KST; 10s ago Process: 6448 ExecStop=/opt/tomcat/bin/shutdown.sh (code=exited, status=0/SUCCESS) Process: 6530 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=0/SUCCESS) Main PID: 6537 (java) CGroup: /system.slice/tomcat.service └─6537 /usr/lib/jvm/jre/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.ap... Oct 05 13:11:14 tomcat-c73 systemd[1]: Starting Apache Tomcat Web Application Container... Oct 05 13:11:14 tomcat-c73 startup.sh[6530]: Tomcat started. Oct 05 13:11:14 tomcat-c73 systemd[1]: Started Apache Tomcat Web Application Container.
- Check service port status
[root@tomcat-c73 ~]# netstat -na | grep 18080 tcp 0 0 0.0.0.0:18080 0.0.0.0:* LISTEN
- Check version information
[root@tomcat-c73 ~]# /opt/tomcat/bin/version.sh Using CATALINA_BASE: /opt/tomcat Using CATALINA_HOME: /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME: /usr Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Using CATALINA_OPTS: Server version: Apache Tomcat/8.5.78 Server built: Mar 31 2022 16:05:28 UTC Server number: 8.5.78.0 OS Name: Linux OS Version: 3.10.0-514.2.2.el7.x86_64 Architecture: amd64 JVM Version: 1.8.0_345-b01 JVM Vendor: Red Hat, Inc.
Check web browser
You can view if the port works properly in the server to which the public IP is assigned.
Open the web browser, and enter the URL.
http(s)://(public IP address):(Tomcat service port)
If it works properly, the basic Tomcat page is displayed.
Examples of running manager module web
You can set the account information to run Tomcat Manager and Tomcat Host Manager modules in the web.
To secure the Tomcat server, leave Tomcat Manager and Tomcat Host Manager in an enabled status. Set the IP range accessible only when necessary to allow access from specific operators and ranges.
While connected to the server, enter the
vi /opt/tomcat/conf/tomcat-users.xml
command.- The editor where you can set Tomcat Manager access accounts is opened.
Press the [I] key to open the input mode, and then add the access account information in the user input area.
- In this example, the user name is entered as admin, and the password is entered as password. It grants access permission to Manager and Host Manager.
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ...(omitted) The users below are wrapped in a comment and are therefore ignored. If you wish to configure one or more of these users for use with the manager web application, do not forget to remove the <!.. ..> that surrounds them. You will also need to set the passwords to something appropriate. --> <user username="admin" password="password" roles="manager-gui,admin-gui"/> <!-- The sample user and role entries below are intended for use with the examples web application. They are wrapped in a comment and thus are ignored when reading this file. If you wish to configure these users for use with the examples web application, do not forget to remove the <!.. ..> that surrounds them. You will also need to set the passwords to something appropriate. --> ...(omitted) </tomcat-users>
If you enter the information, press the [Esc] key to close the input mode, and then enter the
:wq
command to close the editor.Enter the
vi /opt/tomcat/webapps/manager/META-INF/context.xml
command.- The editor where you can set the IP ranges to access Tomcat Manager is opened.
Press the [I] key to open the input mode, and then change the IP range that allows the remote access.
- In this example, the Valve information is annotated to allow access for all IP ranges.
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ...(omitted) <Context antiResourceLocking="false" privileged="true" > <CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor" sameSiteCookies="strict" /> <!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> --> <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/> </Context>
Press the [Esc] key to close the input mode, and then enter
:wq
to close the editor.Enter the
vi /opt/tomcat/webapps/host-manager/META-INF/context.xml
command.- The editor where you can set the IP ranges to access Tomcat Host Manager is opened.
Press the [I] key to open the input mode, and then change the IP range that allows the remote access.
- In this example, the Valve information is annotated to allow access for all IP ranges.
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ...(omitted) <Context antiResourceLocking="false" privileged="true" > <CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor" sameSiteCookies="strict" /> <!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> --> <Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/> </Context>
Press the [Esc] key to close the input mode, and then enter
:wq
to close the editor.Enter the
systemctl restart tomcat
command to restart Tomcat.Enter the URL on the web browser, and then access the Tomcat Manager or Tomcat Host Manager page.
- Tomcat Manager page:
http(s)://(public ip address):(Tomcat service port)/manager/html
- Tomcat Host Manager page:
http(s)://(public ip address):(Tomcat service port)/host-manager/html
- Tomcat Manager page:
When the login pop-up window appears, enter the user name and password you created in step 2, and then click the [Login] button.
- If you log in successfully, the Tomcat web application manager page or the Tomcat virtual host manager page is displayed. You can now run the commands you want.