Wondering how to troubleshoot common site errors in Virtualmin? We can help you with it.
Here at Bobcares, we have seen several such Virtualmin related errors as part of our Server Management Services for web hosts and online service providers.
Today, let’s see some of the common website errors in Virtualmin.
Troubleshooting Common Site Errors in Virtualmin
Now let’s take a look at how our Support Engineers troubleshoot a few common website errors.
Mostly, the webserver problems are relatively easy to troubleshoot. However, some errors are tricky since they are not configuration related error. So they might not show up in the error_log.
As with any control panel, it is important to be able to view your access logs and error logs. This ensures that everything is functioning correctly with the website or server.
Moreover, Virtualmin allows viewing both the access logs and error logs associated with any domain on the server.
Webserver Logs
This is the first place to look to find hints regarding any problem. Normally, the log files for most applications would be stored in the /var/log folder. However, this can vary depending on the Operating System.
The error log can be traced back to the /var/log/apache2/error_log on Debian based servers and the error log file can be found at /var/log/httpd/error_log on RHEL based servers. The access log would be in the same location, exception with the name of access_log. /var/log/apache2/access_log and /var/log/httpd/access_log respectively.
Every virtual server or sub-server in Virtualmin has its own web server log files. They are found in the logs directory in the virtual servers’ home directory (ie, “/home/example/logs”).
How to View The Logs In Virtualmin
- First, log into Virtualmin Control Panel
- Then under the Virtualmin section, select the domain from the dropdown menu that contains the logs to be viewed.
- From the below available options, select the Logs and Reports section
- Here, it is possible to view both the access logs and error logs for Apache web-server separated into two options. To view your Apache Access Logs, click on the respective button. Likewise with the Apache Error Logs.
The Wrong Site Shows Up
Sometimes, if you access the website in the browser and see the wrong website contents, then it is likely an issue with the IP address mismatch on the system.
That is, Apache may be listening for requests for your domain on a particular IP address, but the request came in on a different address than expected.
In order to resolve this problem, first, check the IP address present on the server. Here is the command to find it.
# ip addr sh
Then find what IP address(es) Apache is expected requests to come in on by reviewing the VirtualHost section of your Apache config.
A quick way to do that is using the following command:
On CentOS:
grep -i ‘<virtualhost’ /etc/httpd/conf/httpd.conf
On Ubuntu/Debian:
grep -i ‘<virtualhost’ /etc/apache2/sites-enabled/*.conf
That output will produce a series of lines that look something like this:
<VirtualHost x.y.z.q:80>
Where “x.y.z.q” is the IP address. You would want to make sure that IP addresses listed there are all IP addresses that were shown in your ip addr sh output above.
Then verify that each VirtualHost blocklists an IP address, and not an asterisk (*) character. In case, if you make any changes then do restart the Apache.
Here is the command to restart Apache.
CentOS:
# service httpd restart
Ubuntu/Debian:
# service apache2 restart
After correcting the Apache config, review some options in Virtualmin to make sure new records are being created correctly. Those options are in System Settings >> Virtualmin Config >> Network Settings:
500 Internal Server Error
This is one of the annoying error of every Apache administrator’s existence, as it rarely results in a useful error message in the error_log. And, to compound matters, permission problems show up in the suexec_log, which users do not have access to.
Permissions
A common problem in an environment using suexec is that permissions on the executable files are too loose. If a group or other users can write your scripts in a suexec environment, they will not execute. The right permissions for scripts in a suexec equipped system are 750 or less. The script will be executed as the owner of the domain, so as long as the owner has appropriate permissions the script will be executable by the Apache suexec process.
Script Bugs
Scripts may have errors in syntax or be incompatible with the default version of PHP. In order to check the syntax, you can run the below command from the command line by explicitly calling PHP and the script.
php -l scriptname.php
If you think it might be a version mismatch you could see if the script runs with each of the available versions (Virtualmin provides both PHP4 and PHP5 on most supported platforms).
php4 scriptname.php
And:
php5 scriptname.php
Scripts may also not have the correct permissions for the files it needs to access. A common problem is unzipping or untarring a script archive as root for use by a domain account user. This will result in files that may not be readable or writable by the domain owner, and thus unreadable or unwritable by the suexec process. Check to be sure the files are all owned by the owner of the domain using ls -l. If they aren’t, you can use:
chown -R domainname:domainname scriptdirectory
[Need any further assistance with Virtualmin errors? We’ll help you.]
Conclusion
Today, we saw how our Support Engineers troubleshoot common site errors in Virtualmin.
0 Comments