502 error on NGINX server running with HHVM for a Magento APP

340 views Asked by At

I'm trying to install Magento on a AWS EC2 server running with NGINX & HHVM.

I'm getting a 502 gateway error when I open Magento in the browser. In my /var/log/nginx/error.log I have this error:

2015/06/19 13:40:34 [crit] 1976#0: *4 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 62.77.173.61, server: qa.magento.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "qa.magento.dev"

From this I think NGINX is looking for php5-fpm rather than HHVM. Any idea how I can fix this?

1

There are 1 answers

0
Holly On BEST ANSWER

I was able to fix this by updating my nginx configuration file with

# Handle the exectution of .php files.
    location ~ .php$ {
        if (!-e $request_filename) {
            rewrite / /index.php last;
        }
        expires off;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
        try_files $uri $uri/ @handler;
       # fastcgi_pass unix:/var/run/php5-fpm.sock;
        #fastcgi_param HTTPS $fastcgi_https;
       # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param MAGE_RUN_CODE default;
        fastcgi_param MAGE_RUN_TYPE store;
        include fastcgi_params;
    }