Php – Enable fastcgi on SSL Virtualhost

apache-2.2PHP

Debian 7.5

My VirtualHost for port 80 works fine with the ifmodule for fastcgi. However, it does not work with the VirtualHost for port 443.

SSL/https:// was working fine until I added the following:

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
</IfModule>

When I try to restart Apache I get an error:

Reloading web server config: apache2 failed!

However, if I remove the FastCgiExternalServer line, it works.

Best Answer

In you SSL definition, add this

Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgiSSL
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgiSSL -socket /var/run/php5-fpm.sock -pass-header Authorization

The error you had was due to the double definition of the alias

Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi

By creating an alias with another name (in this case php5-fcgiSSL), your issue is solved