0

I'm tring to configure hhvm and nginx to work on php files at /home/ubuntu/www/www.mysite.com directory

  • first i installed hhvm and nginx from apt get and it's works fine from default directory

  • then i change fastcgi config of /etc/nginx/hhvm.conf from

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

to

fastcgi_param SCRIPT_FILENAME /home/ubuntu/www/www.mysite.com$fastcgi_script_name; 

then i add source root to vim /etc/hhvm/server.ini

hhvm.server.source_root = /home/ubuntu/www/www.mysite.come 

then restarted both nginx and hhvm but still I'm getting php file from default web root not from /home/ubuntu/www/www.mysite.come

here is config file for virtual host

 server { listen 80; server_name www.mysite.se; access_log /var/log/www.mysite.se.access_log; error_log /var/log/www.mysite.se.error_log; location / { root /home/ubuntu/www/www.mysite.se; index index.php index.htm; if (!-f $request_filename){ set $rule_1 1$rule_1; } if (!-d $request_filename){ set $rule_1 2$rule_1; } if ($rule_1 = "21"){ rewrite /. /index.php last; } } #include hhvm.conf; location ~ \.php$ { fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; # fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/ubuntu/www/www.mysite.se$fastcgi_script_name; include fastcgi_params; } } 

when i did a request html files get load from /home/ubuntu/www/www.mysite.se without a problem but php files get load from default nginx folder

3
  • Not enough info. Please post the full server config for this virtual host. Commented Sep 15, 2014 at 6:54
  • What on earth is all that rule_1 mess? Commented Sep 16, 2014 at 18:07
  • if i removed that still not working. same config work fine with php-fpm not hhvm Commented Sep 16, 2014 at 18:20

1 Answer 1

1

The problem in on nginx site configuration file

the root need to be in server block not the location block.

Fore those you are willing to configure nginx with hhvm here is how to do it.

I remanded for you to use ubuntu.

server { listen 80;

server_name www.mysite.se; root /home/ubuntu/www/www.mysite.se; access_log /var/log/www.mysite.se.access_log; error_log /var/log/www.mysite.se.error_log; location / { index index.php index.htm; if (!-f $request_filename){ set $rule_1 1$rule_1; } if (!-d $request_filename){ set $rule_1 2$rule_1; } if ($rule_1 = "21"){ rewrite /. /index.php last; } } #include hhvm.conf; location ~ \.php$ { fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; # fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/ubuntu/www/www.mysite.se$fastcgi_script_name; include fastcgi_params; } } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.