5

I'm trying to setup an apache2 server on debian jessie with multiple vhosts. I want each one of them to have a different FastCgiExternalServer. I'm using the php version from php5-fpm package on jessie with default /etc/php5/fpm configuration files.

Basic apache configuration is working fine :

<VirtualHost *:80>
        ServerName lalala.org
        DocumentRoot "/path/to/app/www"
        <Directory "/path/to/app/www">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                Require all granted
        </Directory>
        FastCgiExternalServer /path/to/app/www -socket /var/run/php5-fpm.sock
        AddHandler php-fcgi .php
        Action php-fcgi /path/to/app/www
</VirtualHost>

However, I got 403 errors on .css, .js files. I read this article : http://whocares.de/fastcgiexternalserver-demystified/8/, but even with this configuration :

        FastCgiExternalServer /path/to/app/www -socket /var/run/php5-fpm.sock
        AddHandler php-fcgi .php
        Action php-fcgi /virtualpath
        Alias /virtualpath /path/to/app/fcgi-uri

(/path/to/app/fcgi-uri is a symlink to /path/to/app/www)

It doesn't work. It's as if I had a local problem but can't figure out what.

Thanks

EDIT : I found a solution that makes fastcgi execution work :

<FilesMatch \.php$>
             SetHandler "proxy:unix:/path/to/sock/socket.sock|fcgi://localhost"
     </FilesMatch>

But I think this is more a workaround than a solution.

Jbb
  • 483
  • 3
  • 15
  • As 403 is a forbidden error, the first thing to check would be that the files which are returning the error have the relevant read permissions in the file system – gabe3886 Apr 23 '15 at 15:14
  • you can update the file permission using chmod – Hardy Mathew Apr 23 '15 at 15:15
  • File permissions are OK, I even tried with 777 permissions to be sure. – Jbb Apr 23 '15 at 15:36
  • a guess : you using a alias before created `Action php-fcgi /virtualpath Alias /virtualpath /path/to/app/fcgi-uri` . try first Alias then Action. – moskito-x Apr 23 '15 at 16:02
  • I tried configurations with many position of those directives but it never worked – Jbb Apr 23 '15 at 16:14
  • Stop guessing and check your apache error log to see what it's telling you why the 403 is happening. – Panama Jack Apr 23 '15 at 16:20
  • 1
    Access to the script '/path/to/app/.../scripts.js' has been denied (see security.limit_extensions). I've already seen this log. It means I need to tell Apache not to give those files to the fastcgi application. But I don't figure out how to. – Jbb Apr 23 '15 at 19:42
  • @J1bz you may need to check the php-fpm permissions usually in `/etc/php-fpm.d/www.conf`. Look for `user` and `group` settings and make sure you're matching the ones what is configured in your apache and grants the right permissions to your files. Also, make sure you haven't done `sudo` on the files at time of deploying it as it often can cause similar issues. Good luck! – Barnabas Kecskes May 16 '15 at 11:13

0 Answers0