The ProxyPassMatch directive is for routing only certain traffic (i.e. requests for php files) to the FastCGI server (i.e. HHVM). Use the ProxyPass directive instead:
ProxyPass / fcgi://127.0.0.1:9000/var/www/whatever.com/
According to the documentation, that should route all requests to the FastCGI server.
Edit: okay, in response to your comment, ProxyPassMatch is the directive you want to use then.
Instead of going back and forth with you on how you have everything set up, I'll just explain how I set it up on Ubuntu 12.04 and maybe you can figure out what you're missing.
First of all, I am using the old .hdf config format even though I'm running HHVM v3.1.0-dev because I can't seem to get the access log working in the new .ini format. I tried hhvm.log.access.file = /var/log/hhvm/access.log
but it didn't work. That's an important log for troubleshooting, so I'm going to stick with .hdf for now.
Here's my upstart script:
description "HipHop VM server"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
umask 002
pre-start script
mkdir -p -m0755 /var/run/hhvm
chown apachetwo:threews /var/run/hhvm
end script
# Location of executable
env SERVER=/usr/local/sbin/hhvm
exec $SERVER --mode daemon -c /etc/hhvm/test.hdf --user apachetwo
Whenever I want to stop and start HHVM, I use sudo stop hhvm
and sudo start hhvm
.
Here's my /etc/hhvm/server.hdf file:
PidFile = /var/run/hhvm/pid
Server {
Type = fastcgi
Port = 9000
SourceRoot = /var/www/html/
DefaultDocument = index.php
}
Log {
Level = Verbose
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
UseLogFile = true
UseSyslog = false
File = /var/log/hhvm/error.log
Access {
* {
File = /var/log/hhvm/access.log
Format = %h %l %u % t \”%r\” %>s %b
}
}
}
Repo {
Central {
Path = /var/log/hhvm/.hhvm.hhbc
}
}
MySQL {
TypedResults = false
}
Theoretically, an equivalent config file in the new .ini
format would look something like this:
; php options
pid = /var/run/hhvm/pid
; hhvm specific
hhvm.server.type = fastcgi
hhvm.server.port = 9000
hhvm.server.source_root = /var/www/html
hhvm.server.default_document = index.php
hhvm.log.level = Verbose
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.log.use_log_file = true
hhvm.log.use_syslog = false
hhvm.log.file = /var/log/hhvm/error.log
hhvm.log.access.file = /var/log/hhvm/access.log
hhvm.log.access.format = %h %l %u % t \”%r\” %>s %b
hhvm.repo.central.path = /var/log/hhvm/.hhvm.hhbc
hhvm.mysql.typed_results = false
And, here's an example VirtualHost file based on one of my sites that's configured to proxy requests for PHP scripts to HHVM. This happens to be for a Laravel 4.2.x site with clean URLs via mod_rewrite. If your site is also configured for clean URLs, be sure that you have [PT]
at the end of the RewriteRule
line so that mod_rewrite will pass the request through to mod_proxy after it's done with it. Initially, I was using [L]
(perhaps in error) and couldn't figure out why mod_proxy wasn't passing the request to HHVM.
<VirtualHost *:80>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/site.com/htdocs/public/$1
DirectorySlash On
DirectoryIndex index.php
ServerAdmin admin@site.com
ServerName www.site.com
DocumentRoot /var/www/site.com/htdocs/public/
AllowEncodedSlashes On
# Don't display the ServerAdmin email address on server generated pages
ServerSignature Off
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !^(index\.php|/images|/includes|/cache|/mpd|/packages|/queues|/samples|/robots\.txt|/sitemap\.xml)
RewriteRule ^(.*)$ /index.php$1 [PT]
<Directory /var/www/site.com/htdocs>
Require all granted
Options +FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/site.com/htdocs/public>
Require all granted
Options +FollowSymLinks
AllowOverride None
</Directory>
ErrorLog /var/log/apache2/www.site.com.error.log
LogLevel alert rewrite:trace6 proxy:trace6
CustomLog /var/log/apache2/www.site.com.access.log combined
</VirtualHost>
I think those are the main three configuration files that you'll need to focus on. The ProxyPassMatch directive should instruct Apache to proxy requests for PHP files to HHVM. Requests for other file types should be served by Apache as they would be normally. If you can comment out the ProxyPassMatch directive, restart Apache and everything works as it should, then I would be surprised. I'm guessing your Apache is to blame for serving up CSS, JS and HTML files as downloads.