Tomcat8已运行但无法加载页面,8080端口curl无响应求助
Hey there, let's work through why your Tomcat 8 instance on DigitalOcean's Ubuntu 16.04 isn't responding to curl on port 8080. I've tackled similar issues before, so here's a step-by-step breakdown of what to check:
1. Verify Tomcat is Actually Running
First things first—make sure Tomcat is up and running. Use these commands to confirm:
- Check service status:
systemctl status tomcat8 - List active Tomcat processes:
ps aux | grep tomcat
If it's not running, start it immediately with: systemctl start tomcat8
To ensure it launches automatically on server boot: systemctl enable tomcat8
2. Check for Port Conflicts
Port 8080 might be occupied by another application. Run these commands to see what's using the port:
netstat -tulpn | grep 8080ss -tulpn | grep 8080
If you spot another process holding the port, you can either kill that process with kill <PID> (replace <PID> with the process ID) or change Tomcat's listening port:
Edit /etc/tomcat8/server.xml, find the <Connector> tag, and modify the port attribute to an unused port (like 8081), then restart Tomcat.
3. Firewall & Network Rules Check
Ubuntu UFW Firewall
Check if UFW is blocking incoming traffic on port 8080: ufw status
If you don't see 8080/tcp ALLOW Anywhere listed, add the rule:ufw allow 8080/tcp
Then reload UFW to apply changes: ufw reload
DigitalOcean Cloud Firewall
Don't forget the cloud-level firewall! Head to your DigitalOcean dashboard, navigate to your droplet's firewall settings, and confirm there's an inbound rule allowing TCP traffic on port 8080 (either from your specific IP or all IPs, depending on your needs).
4. Review Full Catalina Logs
You only shared a snippet of the logs—let's dig into the full files to spot errors:
- Main Tomcat log:
cat /var/log/tomcat8/catalina.out - Localhost access/error logs:
cat /var/log/tomcat8/localhost.log
Look for critical red flags like:
Address already in use(confirms port conflict)- Java class loading failures (points to JRE/JDK configuration issues)
- Failed web application deployments
5. Test Local vs. Remote Access
First test from the droplet itself: curl localhost:8080
- If this works, the problem is with network/firewall rules blocking remote access.
- If this fails, Tomcat isn't properly listening or has a core configuration issue.
6. Validate Tomcat's Connector Configuration
Ensure Tomcat is listening on all network interfaces (not just localhost). Edit /etc/tomcat8/server.xml and find the HTTP Connector entry:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
If there's an address="127.0.0.1" attribute, remove it (or set it to address="0.0.0.0" to allow all IPs), then restart Tomcat: systemctl restart tomcat8
内容的提问来源于stack exchange,提问作者NashPL

