Reputation: 111
I want the Hip Hop Virtual Machine run php code for only one specific website. All other websites and images will still be served by Apache. I have installed HHVM and it's running on port 88.
I guess I need to add a rewrite rule to .htaccess of that website to redirect requests for .php files to port 88. Is this the right solution? If so, what should I add?
Upvotes: 1
Views: 3341
Reputation: 111
I've found a solution by setting the sourceroot to the specific website, which is based on the SLIM/PHP framework. It happened to serve no images, so no need to filter on that. Here is the config for HHVM:
Server {
Port = 88
SourceRoot = /var/www/<specific-folder>
DefaultDocument = index.php
}
VirtualHost {
www {
Pattern = .*
ServerVariables {
PHP_SELF = /index.php
SCRIPT_NAME = /index.php
}
RewriteRules {
index {
pattern = ^(.*)$
to = index.php/$1
qsa = true
}
}
}
}
Upvotes: 3
Reputation: 143926
You probably want to reverse proxy instead. If you have access to the vhost/server config files, you can add lines like this:
ProxyPassMatch ^/(.*)\.php$ http://127.0.0.1:88/$1.php
ProxyPassReverse / http://127.0.0.1:88/
Or if you have mod_proxy turned on, you can do this in the htaccess file using the P
flag:
RewriteRule ^(.*)\.php$ http://127.0.0.1:88/$1.php [L,P]
ProxyPassReverse / http://127.0.0.1:88/
Upvotes: 3