到目前为止,这是我已经完成的工作:
$ 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
在正确的TCP端口配置下,它可以很好地工作,但是用UNIX套接字配置替换它会导致与端口配置错误相同的nginx错误。
您应该检查文件权限。
nginx必须能够写入php5-fpm或hhvm Unix套接字。
您可能会在nginx错误日志中找到这样的一行/var/log/nginx/error.log
,确认这是问题所在:
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"
解决方案:将nginx
用户添加到拥有套接字的用户组中(通常是www-data
)。该套接字文件应该是该组可写的,因此最好使用以下命令:
# usermod -a -G www-data nginx
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句