Назад | Перейти на главную страницу

Докер: конфигурация сокета Nginx и hhvm возвращает 502 Bad Gateway

Я пытаюсь запустить nginx и hhvm с конфигурацией файла docker-compose и socket, но он возвращает ошибку 502. Я могу получить доступ к conf / hhvm / run / из изображений nginx и hhvm. В файле error.log nginx я получил:

[error] 5#5: *3 connect() to unix:/var/run/hhvm/hhvm.sock failed (111: Connection refused) while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/hhvm/hhvm.sock:", host: "xxxxxxx.io", referrer: "http://xxxxxxx.io/"

файл docker-compose:

nginx:
  image: nginx
  restart: always
  ports:
    - 80:80
  log_driver: syslog
  links:
    - hhvm
  volumes:
    - ./www:/var/www/wp:rw
    - ./conf/nginx:/etc/nginx:rw
    - ./log/nginx:/var/log/nginx
    - ./conf/hhvm/run:/var/run/hhvm

hhvm:
  image: diegomarangoni/hhvm
  volumes:
    - ./log/hhvm:/var/log/hhvm
    - ./conf/hhvm/run:/var/run/hhvm
    - ./conf/hhvm:/etc/hhvm:rw
  command: hhvm -u nginx -m server -vServer.Type=fastcgi -vLog.Level=Verbose

Nginx:

файл nginx.conf:

user  nginx;
worker_processes  1;
pid        /var/run/nginx.pid;

events {
  worker_connections  2048;
  multi_accept on;
  use epoll;
}

http {
  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

  access_log  /var/log/nginx/access.log  main;
  error_log   /var/log/nginx/error.log;


  server_tokens off;
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 15;
  types_hash_max_size 2048;
  include /etc/nginx/mime.types;

  default_type application/octet-stream;
  gzip on;
  gzip_disable "msie6";
  open_file_cache max=100;

  server {
    listen       80;
    server_name xxxxxxx.io;
    root /var/www/wp;
    index index.html index.htm index.hh index.php;
    include /etc/nginx/hhvm.conf;

    location / {
      try_files $uri $uri/ /index.php?$args;
    }
  }
}

hhvm.conf:

location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass   unix:/var/run/hhvm/hhvm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

Hhvm:

php.ini:

; php options
session.save_handler = files
session.save_path = /var/lib/hhvm/sessions
session.gc_maxlifetime = 1440

; hhvm specific
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false

server.ini:

; php options

pid = /var/run/hhvm/pid

; hhvm specific

hhvm.server.file_socket=/var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = /var/www/wp/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

Редактировать: У меня появилась новая ошибка, если я использовал изображение jolicode / hhvm вместо diegomaragon / hhvm:

hhvm_1  | WARNING: Logging before InitGoogleLogging() is written to STDERR
hhvm_1  | E1214 23:22:35.751377     1 fastcgi-server.cpp:104] 13failed to bind to async server socket: 0.0.0.0:80: Permission denied
hhvm_1  | Permission denied listening on port 80
hhvm_1  | Unable to start page server
hhvm_1  | Shutting down due to failure(s) to bind in HttpServer::runAndExitProcess
docker_hhvm_1 exited with code 1