I am using Apache/2.2.17 (Ubuntu) mod_fastcgi with php-fpm
Cant enable clean urls as the site returns Internal Server Errors . I think something is not write in my .htaccess settings. same server contains wordpress under different virtual host and it works fine.
Please help ,

this are some relevant information that can help to solve the problem i guess .

thanks in advance

my virtual host contains

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/dowsin/public_html
FastCgiExternalServer /home/dowsin/public_html/php5.external -host 127.0.0.1:9000
AddHandler php5-fcgi .php
Action php5-fcgi /usr/lib/cgi-bin/php5.external
Alias /usr/lib/cgi-bin/ /home/dowsin/public_html/
RewriteLog "/home/dowsin/public_html/rewrite.log"
RewriteLogLevel 3
<Directory "/home/dowsin/public_html">
allow from all
Options -Indexes
AllowOverride all

</Directory>
</VirtualHost>

.htaccess contains

   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

rewrite_log

xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9581b80/initial/redir#5] (3) [perdir /home/dowsin/public_html/] add per-dir prefix: index.php -> /home/dowsin/public_html/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9581b80/initial/redir#5] (2) [perdir /home/dowsin/public_html/] trying to replace prefix /home/dowsin/public_html/ with /
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9581b80/initial/redir#5] (1) [perdir /home/dowsin/public_html/] internal redirect with /index.php [INTERNAL REDIRECT]
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9583cb0/initial/redir#6] (3) [perdir /home/dowsin/public_html/] strip per-dir prefix: /home/dowsin/public_html/index.php -> index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9583cb0/initial/redir#6] (3) [perdir /home/dowsin/public_html/] applying pattern '^(.*)$' to uri 'index.php'
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9583cb0/initial/redir#6] (1) [perdir /home/dowsin/public_html/] pass through /home/dowsin/public_html/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (3) [perdir /home/dowsin/public_html/] add path info postfix: /home/dowsin/public_html/php5.external -> /home/dowsin/public_html/php5.external/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (3) [perdir /home/dowsin/public_html/] strip per-dir prefix: /home/dowsin/public_html/php5.external/index.php -> php5.external/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (3) [perdir /home/dowsin/public_html/] applying pattern '^(.*)$' to uri 'php5.external/index.php'
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (2) [perdir /home/dowsin/public_html/] rewrite 'php5.external/index.php' -> 'index.php?q=php5.external/index.php'
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (3) split uri=index.php?q=php5.external/index.php -> uri=index.php, args=q=php5.external/index.php&q=php5.external/index.php&q=php5.external/index.php&q=php5.external/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (3) [perdir /home/dowsin/public_html/] add per-dir prefix: index.php -> /home/dowsin/public_html/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (2) [perdir /home/dowsin/public_html/] trying to replace prefix /home/dowsin/public_html/ with /
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9585028/initial/redir#7] (1) [perdir /home/dowsin/public_html/] internal redirect with /index.php [INTERNAL REDIRECT]
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b95872b0/initial/redir#8] (3) [perdir /home/dowsin/public_html/] strip per-dir prefix: /home/dowsin/public_html/index.php -> index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b95872b0/initial/redir#8] (3) [perdir /home/dowsin/public_html/] applying pattern '^(.*)$' to uri 'index.php'
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b95872b0/initial/redir#8] (1) [perdir /home/dowsin/public_html/] pass through /home/dowsin/public_html/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (3) [perdir /home/dowsin/public_html/] add path info postfix: /home/dowsin/public_html/php5.external -> /home/dowsin/public_html/php5.external/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (3) [perdir /home/dowsin/public_html/] strip per-dir prefix: /home/dowsin/public_html/php5.external/index.php -> php5.external/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (3) [perdir /home/dowsin/public_html/] applying pattern '^(.*)$' to uri 'php5.external/index.php'
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (2) [perdir /home/dowsin/public_html/] rewrite 'php5.external/index.php' -> 'index.php?q=php5.external/index.php'
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (3) split uri=index.php?q=php5.external/index.php -> uri=index.php, args=q=php5.external/index.php&q=php5.external/index.php&q=php5.external/index.php&q=php5.external/index.php&q=php5.external/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (3) [perdir /home/dowsin/public_html/] add per-dir prefix: index.php -> /home/dowsin/public_html/index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (2) [perdir /home/dowsin/public_html/] trying to replace prefix /home/dowsin/public_html/ with /
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b9588760/initial/redir#9] (1) [perdir /home/dowsin/public_html/] internal redirect with /index.php [INTERNAL REDIRECT]
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b958abd0/initial/redir#10] (3) [perdir /home/dowsin/public_html/] strip per-dir prefix: /home/dowsin/public_html/index.php -> index.php
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b958abd0/initial/redir#10] (3) [perdir /home/dowsin/public_html/] applying pattern '^(.*)$' to uri 'index.php'
xxx.xxx.xxx.xxx - - [01/Aug/2011:15:59:20 +0000] [www.example.com/sid#b95185c8][rid#b958abd0/initial/redir#10] (1) [perdir /home/dowsin/public_html/] pass through /home/dowsin/public_html/index.php

server error log

[Mon Aug 01 15:59:20 2011] [error] [client xxx.xxx.xxx.xxx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Comments

bioshock’s picture

If its not clear let me know. i can't figure out what to do. i am still getting 500 internal server error

thanks

bioshock’s picture

Need to add

RewriteCond %{REQUEST_URI} !php5\.external to the htaccess file

it was trying to rewrite php5.external

wdakamal’s picture

You need to make sure that following is included in either fastcgi.conf or your virtualhost file.
But it is preferred to be added in fastcgi.conf file in case you are hosting multiple sites on the same server.

sudo nano /etc/apache2/mods-available/fastcgi.conf

<IfModule mod_fastcgi.c>
               # [ -- Leave the old lines  ---]
		AddHandler php5-fcgi .php
		Action php5-fcgi /usr/lib/cgi-bin/php5.external

		<Location "/usr/lib/cgi-bin/php5.external">
			Order deny,allow
			Deny from all
			Allow from env=REDIRECT_STATUS
		</Location>
	</IfModule>

And for Drupal try to make your virtual hosts files as following:

Options None
<Directory "/home/dowsin/public_html">
               Options SymLinksIfOwnerMatch  MultiViews IncludesNoExec

               AllowOverride FileInfo AuthConfig Limit Indexes Options
                Order allow,deny
                Allow from all

</Directory>

Also you might consider, using sockets instead of TCP/IP connections, which will give you a better results:

# first create your ".socks" folder 
sudo mkdir -p /home/dowsin/.socks

# We will need these folder:
sudo mkdir -p /home/dowsin/tmp

And in your virtual host change:

FastCgiExternalServer /home/dowsin/public_html/php5.external -host 127.0.0.1:9000

with:

FastCgiExternalServer /home/dowsin/public_html/php5.external -socket /home/dowsin/.socks/dowsin.sock -idle-timeout 60 

And the last step to inform php-fpm to use sockets:

# A few settings I like to change in /etc/php5/fpm/pool.d/www.conf:

# Taking a backup
sudo cp /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/www.conf.old

# Remove execution permissions
sudo chomd a-x /etc/php5/fpm/pool.d/www.conf.old

sudo nano /etc/php5/fpm/pool.d/www.conf

sudo groupadd webgroup
sudo useradd -b /home/dowsin -g webgroup  -s /bin/false dowsin

Replace the content with:


; Pool name
[nilecode]
; We will use a socket
listen = /home/dowsin/.socks/dowsin.sock

; Permission for the socket
listen.owner = dowsin
listen.group = webgroup
listen.mode = 0666

; User / Processes Group
user = dowsin
group = webgroup

; We choose a dynamic management process
pm = dynamic

pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10

slowlog = /var/log/php5-fpm/dowsin.log.slow

; Some guidelines for configuring PHP
php_admin_value[open_basedir]=/home/dowsin/public_html
php_admin_value[session.save_path]=/home/dowsin/tmp
php_admin_value[upload_tmp_dir]=/home/dowsin/tmp

For more information check: http://www.nilecode.com/