
When a website stops loading or an API stops responding, the first question is always the same: is the web service actually running? Answering it quickly is essential for minimizing downtime and diagnosing problems. A web service can fail for many reasons, including crashed processes, network issues, misconfigured firewalls, expired certificates, or exhausted resources. This guide explains practical, hands-on methods to check if a web service is running, from simple browser checks to command-line diagnostics on Linux and Windows servers.
Build Reliable Web Services with AAMAX.CO
Reliable services start with solid architecture. AAMAX.CO is a full-service digital marketing company offering web development, digital marketing, and SEO services worldwide. Their web application development team designs APIs and web services with health check endpoints, structured logging, and resilient deployment practices. They help businesses reduce outages and troubleshoot issues faster, ensuring customers always have access to the services they rely on.
Step 1: Check from a Browser
The simplest test is to open the service URL in a browser. If a web page or JSON response loads, the service is running and reachable. Pay attention to error messages, as they reveal a lot:
- Connection refused: Nothing is listening on that port, usually meaning the service is stopped.
- Timed out: A firewall or network issue may be blocking access, or the server is overloaded.
- 502 Bad Gateway: A reverse proxy is running, but the backend application behind it is not responding.
- 503 Service Unavailable: The service is temporarily overloaded or in maintenance mode.
- 500 Internal Server Error: The service is running but encountering an application error.
Step 2: Use curl for Detailed Responses
The curl command, available on Linux, macOS, and modern Windows, provides precise information. Run:
curl -I https://example.comThe -I flag fetches only headers, showing the HTTP status code and server details. For a verbose view of DNS resolution, TLS negotiation, and connection steps, use curl -v. If your service exposes a health endpoint, such as /health or /status, query it directly to confirm the application and its dependencies are working.
Step 3: Verify Network Reachability
If the service does not respond, check whether the server itself is reachable. Use ping to test basic connectivity, though some servers block ping requests for security. Use traceroute on Linux and macOS, or tracert on Windows, to see where the connection fails along the network path. Also confirm DNS resolution with nslookup or dig to ensure the domain points to the correct IP address.
Step 4: Check If the Port Is Open
A web service listens on a specific port, typically 80 for HTTP and 443 for HTTPS, or custom ports like 3000 or 8080 for applications. From another machine, test the port using:
nc -zv example.com 443On Windows PowerShell, use Test-NetConnection example.com -Port 443. If the port is closed, the service may be stopped, or a firewall may be blocking it. On the server itself, run ss -tlnp or netstat -tlnp on Linux to list listening ports and the processes using them.
Step 5: Check the Service Status on the Server
On Linux systems using systemd, check a service with:
systemctl status nginxReplace nginx with your service name, such as apache2, httpd, or your application's unit. The output shows whether the service is active, when it started, and recent log entries. If it is stopped, start it with systemctl start and investigate why it failed.
For Node.js applications managed by PM2, run pm2 status. For containers, use docker ps to list running containers and docker logs to inspect output. In Kubernetes, kubectl get pods and kubectl describe pod reveal the state of each workload.
On Windows servers, open the Services console with services.msc, or use PowerShell with Get-Service to view service status. For IIS-hosted sites, check the IIS Manager to confirm both the website and its application pool are started.
Step 6: Review Logs
Logs provide the clearest explanation of failures. Use journalctl -u servicename on systemd-based systems, or review application and web server logs, often found in /var/log/. Look for errors related to configuration, missing environment variables, database connection failures, port conflicts, or out-of-memory events. On Windows, the Event Viewer contains application and system logs.
Step 7: Check Resource Usage
A service may appear running but be unresponsive due to resource exhaustion. Use top, htop, or free -m to check CPU and memory usage, and df -h to ensure the disk is not full. A full disk is a surprisingly common cause of failed web services, as logs and databases can no longer write data.
Step 8: Verify SSL Certificates
An expired or misconfigured SSL certificate can make a working service appear down to users. Check the certificate details in the browser by clicking the padlock icon, or run openssl s_client -connect example.com:443 to view certificate information and expiration dates.
Quick Troubleshooting Checklist
- Does the URL load in a browser, and what error appears?
- Does curl return a valid status code?
- Does DNS resolve to the correct IP address?
- Is the port open and listening?
- Is the service or container running?
- Do the logs show errors?
- Are CPU, memory, and disk resources healthy?
- Is the SSL certificate valid?
Conclusion
Checking if a web service is running involves working through layers: the browser response, HTTP status codes, network reachability, open ports, process status, logs, resources, and certificates. By following these steps systematically, you can quickly pinpoint where a failure occurs and restore service. Building health endpoints and structured logging into your applications makes future troubleshooting even faster.