Suexec Issue: pages redirecting to cgi-bin directory

4 posts / 0 new
Last post
#1 Thu, 10/07/2010 - 03:38
byrnef87

Suexec Issue: pages redirecting to cgi-bin directory

Hi,

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 www.aceaerobics.com.au, it goes to www.aceaerobics.com.au/cgi-bin/about-us).

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 124.190.156.71] script not found or unable to stat: /home/domains/aceaerobics/cgi-bin/about-us, referer: http://aceaerobics.com.au/"

I get no errors in the suexec.log.

Servers -> Virtualmin Virtual Servers -> aceaerobics.com.au -> 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/aceaerobics.com.au.conf:

<VirtualHost *:80>
ServerName aceaerobics.com.au
ServerAlias www.aceaerobics.com.au
ServerAlias webmail.aceaerobics.com.au
ServerAlias admin.aceaerobics.com.au
DocumentRoot /home/domains/aceaerobics/public_html
ErrorLog /var/log/virtualmin/aceaerobics.com.au_error_log
CustomLog /var/log/virtualmin/aceaerobics.com.au_access_log 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>
<Directory /home/domains/aceaerobics/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.aceaerobics.com.au
RewriteRule ^(.*) http://aceaerobics.com.au:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.aceaerobics.com.au
RewriteRule ^(.*) https://aceaerobics.com.au:10000/ [R]
SuexecUserGroup "#1014" "#1012"
RemoveHandler .php
RemoveHandler .php5
</VirtualHost>

/etc/apache2/suexec/www-data:

/home/domains
public_html
# 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.

Thanks!

Francis

Thu, 10/07/2010 - 09:56
andreychek

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

-Eric

Thu, 10/07/2010 - 11:16
byrnef87

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: http://iceboundflame.com/2009/06/notes-on-virtualmin-gpl-suexec-and-php-5/comment-page-1#comment-13524

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

Cheers,

Francis

Thu, 10/07/2010 - 12:22
andreychek

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.

-Eric

Topic locked