Suexec Issue: pages redirecting to cgi-bin directory


I’m trying to get suexec working with php-cgi on my VPS which has Webmin/Virtualmin (GPL) installed. However when I set a website to use CGI wrapper to execute scripts as virtual host owner, pages no longer load properly (css doesn’t load, if I select any links it goes to 404).

I think the problem is that it is redirecting my urls to cgi-bin instead of public_html (eg. if I click the “About Us” link in my home page for, it goes to

Further Information:

The website is based on the Joomla! CMS.

I want the website to run as the aceaerobics user so that file uploads + writing to configuration.php etc. won’t cause permissions issues. Also because I understand that it is more secure.

Permissions for all files in aceaerobics virtualhost directory are 644, directories are 755. All files are owned by aceaerobics and group aceaerobics.

I get the following error in my apache error.log:

“[Thu Oct 07 18:11:26 2010] [error] [client] script not found or unable to stat: /home/domains/aceaerobics/cgi-bin/about-us, referer:

I get no errors in the suexec.log.

Servers -> Virtualmin Virtual Servers -> -> Website Options:

Run CGI scripts as domain owner: Yes

PHP script execution mode: CGI wrapper (run as virtual server owner)

Website matches all sub-domains: No

Default website for IP address: No

Website documents sub-directory: public_html

httpd.conf is empty, but here is the site config, sites-enabled/

<VirtualHost *:80>
DocumentRoot /home/domains/aceaerobics/public_html
ErrorLog /var/log/virtualmin/
CustomLog /var/log/virtualmin/ combined
ScriptAlias /cgi-bin/ /home/domains/aceaerobics/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/domains/aceaerobics/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks
allow from all
AllowOverride All
Action application/x-httpd-php5 /cgi-bin/php5.cgi
AddType application/x-httpd-php5 .php5
AddType application/x-httpd-php5 .php
<Directory /home/domains/aceaerobics/cgi-bin>
allow from all
RewriteEngine on
RewriteCond %{HTTP_HOST}
RewriteRule ^(.*) [R]
RewriteCond %{HTTP_HOST}
RewriteRule ^(.*) [R]
SuexecUserGroup "#1014" "#1012"
RemoveHandler .php
RemoveHandler .php5


# The first two lines contain the suexec document root and the suexec userdir
# suffix. Both features can be disabled separately by prepending a # character.
# This config file is only used by the apache2-suexec-custom package.

I’ve also attached /etc/php5/cgi/php.ini and /etc/apache2/apache2.conf (because it will take up too much space if I paste it all here).

Sorry for the information overload, I just don’t want to miss anything out.

I really hope someone can help because I’ve been working on this for many, many hours.



Hmm, what version of PHP are you using? Are you by chance using a newer PHP version?


Hi Eric,

Yeah, I’m using version 5.2.10-2ubuntu6.5, according to system info.

I actually ended up finding a workaround for this problem. I modified the Server Template as per this tutorial:

I’d be interested to know what the original issue was though, because I like the idea of one-click suexec/php-cgi setup.



What you’re seeing may be a change in the way PHP 5.2.10+ functions… if you run into that again, try editing the php.ini file for that particular domain, set “cgi.fix_pathinfo=0”, and see if that takes care of the problem for you.