magento - Run HHVM and PHP simultaneously with Nginx -
i've been running magento site using hhvm , nginx. far hadn't experienced problems , got welcomed noticeable performance boost.
however, i've added plugin uses php functions unsupported hhvm. news plugin needed 1 page. bad news i'm not configuring nginx right serve page php.
the usual fallback trick used people using error directives not work in case because page doesn't throw error. doesn't work if hhvm enabled.
instead, i've tried write many variations of location blocks particular page. none worked, , these 2 had thought trick.
is there way run php specific page?
failed solution 1
location ~ /page/.+\.php${ if (!-e $request_filename) { rewrite / /index.php last; } fastcgi_pass unix:/var/run/php5-fpm.sock; ##unix socket fastcgi_param https $fastcgi_https; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; } location ~ \.(hh|php)$ { if (!-e $request_filename) { rewrite / /index.php last; } fastcgi_keep_conn on; fastcgi_pass unix:/var/run/hhvm/sock; fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_param https $fastcgi_https; include fastcgi_params; }
failed solution 2 (with nested location)
location ~ /page/ { location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } fastcgi_pass unix:/var/run/php5-fpm.sock; ##unix socket fastcgi_param https $fastcgi_https; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; } } location ~ \.(hh|php)$ { if (!-e $request_filename) { rewrite / /index.php last; } fastcgi_keep_conn on; fastcgi_pass unix:/var/run/hhvm/sock; fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_param https $fastcgi_https; include fastcgi_params; }
try using variable condition approach, works me, locations starting /serve-with-php/
being served unix:/var/run/php5-fpm.sock
, while others being served 127.0.0.1:9000
server { root /home/vearutop/test-hhvm; index index.php index.html index.htm; error_log /var/log/nginx-error.log error; charset utf-8; server_name test-hhvm; location / { set $fcgi_worker 127.0.0.1:9000; # hhvm handle try_files $uri $uri/ /index.php?$query_string; } location /serve-with-php/ { set $fcgi_worker unix:/var/run/php5-fpm.sock; # php-fpm handle try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass $fcgi_worker; fastcgi_index index.php; include fastcgi_params; } }
Comments
Post a Comment