OK, I found that if I comment out this line under[ VirtualHost] section in the httpd.conf:
SuexecUserGroup "#501" "#501"
the CGI scripts will work again.
Perhaps I should also mention that when creating the virtual website, I have specified my own administrator username and password (instead of the default option of “automatic”). The administrator’s userID is 501, same as the line above.
Could someone please advise what is the correct way to make CGI scripts work again? Should I remove the "SuexecUserGroup "#501" "#501"" line in httpd.conf?
Commenting this line out turns off SuExec…so everything executes as the Apache user. This isn’t a particularly bad thing, if your users are trusted. It is probably inadvisable otherwise.
The reason it’s happening is that the suexec_docroot doesn’t match where your homes are. In the original posters case, moving into /var/www/html was the source of the trouble–reverting to the system stock Apache packages would correct the problem in his case. I don’t know the source of the trouble in your case–I suspect you’ve got a Debian or Ubuntu system, and it’s ended up with the wrong apache2 package. (My fault. I’m trying to rectify it now.)
So, let me know the platform, and I’ll be able to be specific about what you need to check to be sure you have the right Apache build.