Troubleshoot Error 404, Error 111, and "no host given" error when installing the Apache plugin
When installing the Apache monitoring plugin, you may encounter the following errors:
Error_code : URL Error no host given: The "no host given" error message typically indicates an issue with a URL or request that lacks a hostname. If you encounter this error while working with an Apache status page, it's possible that you might be missing the hostname in the URL. Error_code : HTTP Error 404: An Apache web server returns a 404 error when it cannot locate a requested resource due to factors like incorrect URLs, permissions issues, or configuration errors.
[Errno 111] Connection refused: This error typically indicates that a connection cannot be established with Apache. This error can occur if the Apache service is not running or there is an issue with its configuration.
To resolve the issues, you can try reinstalling the plugin using our Apache installer for Linux. It checks the prerequisites and installs the plugin. The installer verifies the Apache status module, validates the URL and hostname, downloads the plugin from our GitHub, and configures the .cfg file.
Simply execute the command below in the terminal of your Linux server and follow the in-line instructions to use the installer:
If you're not using Linux servers or want to troubleshoot the issues manually, follow the steps below.
- Ensure that the URL is correct: When trying to access the Apache status page, check the accuracy of the URL you are using. A typical URL for an Apache status page resembles this format: http://hostname/server-status. Replace "hostname" with the actual hostname or IP address of your server.
- Check the Apache configuration: If the URL appears to be correct but you still encounter the error, inspect your Apache server's configuration related to the mod_status module. Ensure that the Location directive is configured correctly.
For Apache 2.4 and later versions, the configuration should look like the following. Confirm that the host you are connecting from is allowed access, as specified in the Require directive.
<Location /server-status>
SetHandler server-status
Require all granted
</Location>
For Apache 2.2, update the Allow, Order, and Deny directives as shown below:
<Location /server-status>
SetHandler server-status
Order allow,deny
Deny from all
Allow from all
</Location>
- Check plugin .cfg file: Inspect the credentials in the plugin .cfg file and ensure you have provided the correct username and password.
- Verify hostname resolution: Confirm that the hostname mentioned in the URL resolves to the correct IP address. You can test this using commands such as ping or nslookup, as shown below:
ping hostname
or
nslookup hostname
Replace hostname with the actual hostname you are trying to access.
- Check firewall settings: A firewall might be blocking the connection. Ensure that the port you are trying to access is allowed through any firewalls on the server or the network.
- Restart Apache: Sometimes, restarting the Apache server can resolve issues. You can do this by executing one of the following commands, depending on your system:
sudo systemctl restart apache2
or
sudo service apache2 restart
Following the steps above should help you identify and resolve both the "Error 404" and the "no host given" error associated with Apache status page access.
Once you've made changes based on the checks above, restart the Site24x7 server monitoring agent or re-register the plugin. Within five minutes, you should be able to view performance metrics in Site24x7.