2

So far this is what I've done:

$ less /etc/nginx/hhvm.conf
location ~ \.(hh|php)$ {
    fastcgi_pass   unix:/var/run/hhvm/sock;
    include        fastcgi_params;
}

$ less /etc/hhvm/server.ini
; php options

pid = /var/run/hhvm/pid

; hhvm specific 

hhvm.server.file_socket = /var/run/hhvm/sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc

It worked perfectly well with proper TCP port configuration, but replacing it with UNIX socket configuration results in same nginx error as a port misconfiguration.

Oxwivi
  • 2,232
  • 4
  • 23
  • 31

1 Answers1

2

You should check the file permissions.

nginx must be able to write to the php5-fpm or hhvm Unix socket.

You probably can find a line like this one inside the nginx error log /var/log/nginx/error.log, confirming that this is the problem:

2015/10/28 16:32:24 [crit] 14845#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "HEAD /test.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "localhost"

Solution: Add the nginx user to the group of the user owning the socket (usually www-data). The socket file should be writable by the group, so you would be good to go with the following command:

# usermod -a -G www-data nginx
Mehdi
  • 160
  • 1
  • 6