php-fpm apache2 403 error on .css .js files

坚强是说给别人听的谎言 提交于 2019-12-10 15:22:53

问题


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.

来源:https://stackoverflow.com/questions/29827527/php-fpm-apache2-403-error-on-css-js-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!