In Linux distributions, the suexec utility allows PHP to run in FastCGI and CGI modes only for users with GID and UID above 1000. If users with GID/UID below 1000 were migrated, this may cause errors when opening websites.
How does the problem manifest itself?
Users often see the following errors:
ERR_TOO_MANY_REDIRECTS for CGI;
Internal Server Error for FastCGI.
If you look at the web service log, you are likely to find the following entry:
cgid: error reading data from FastCGI server, referer: https://domain.con
End of script output before headers: index.php, referer:https://domain.con
All of this indicates that there is a problem. One of the most common problems is related to changes in the operation of utilities and system components between distributions. Let's look at ways to fix them.
How to solve the problem?
You can use one of the methods described below. First, create new users with the correct GID/UID.
Then transfer the data using the “Change Owner” tool.
An alternative option is to make backup copies of users and their data, delete them, and restore them from a fresh backup.
DNS issues
In Ubuntu 20.04, DNS resolution is managed by default by the systemd-resolved component, which dynamically updates the /etc/resolv.conf file. This can cause DNS settings changes to be temporarily applied or reset.
The error can be resolved by editing resolved.conf. To do this, open the /etc/systemd/resolved.conf file and add the necessary DNS servers. For example:
text
[Resolve]
DNS=8.8.8.8 8.8.4.4
After making the changes, restart the service: systemctl restart systemd-resolved
Install the resolvconf utility
sudo apt install resolvconf
Then edit the file /etc/resolvconf/resolv.conf.d/base, specifying the desired DNS servers. Apply the changes with the command
resolvconf -u.
Lock the /etc/resolv.conf file. Use the command chattr +i /etc/resolv.conf to prevent it from being changed.
Check network settings and availability
Check the DNS settings. Make sure that the domain points to the correct IP address. Use the nslookup or dig commands.
Check the availability of the site. Try to access the site via curl: curl -I https://example.com. Pay attention to the response code, headers, and redirects.
Check the web server logs. Examine the Apache, Nginx, or other server logs for errors. For example, errors such as ERR_TOO_MANY_REDIRECTS or Internal Server Error may indicate configuration issues.
Other possible causes
Incorrect migration of configuration files. Check the web server configuration files (e.g., apache2.conf, nginx.conf) for syntax errors or outdated settings.
Problems with SSL certificates. Certificates must be up to date and correctly configured on the new server.
Errors in redirects. Check for redirect chains or incorrect redirects. Firewall or SELinux. Review all firewall rules and SELinux settings. They should not block access to the web server.
If the problem persists:
- Make a full backup of the system and data.
- Check the documentation for the software you are using (e.g., control panel) — there may be specific configuration requirements after migration.
- Contact a Linux administration specialist.
For a more accurate diagnosis, provide additional details: web server type, log errors, technologies used, and migration tools.