数字海洋上的坏网关502(nginx + php7)

每次当我尝试发布我的网站,我得到几分钟后502错误的网关错误,并在我的default-error.log文件我得到这个错误反复(文件大小为360MB ..):

 2016/02/03 14:57:28 [error] 1044#1044: *7248 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 123.456.78.90, server: default, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "domain.com" 

服务器configuration

  • 操作系统:Ubuntu 14.04.3 LTS(GNU / Linux 3.13.0-71-generic x86_64)
  • Nginx版本:1.9.10
  • PHP版本PHP 7.0.2-4 + deb.sury.org〜trusty + 1(cli)(NTS)
  • (我的服务器托pipe在数字海洋,它有4GB的RAM)。

nginx.conf

 server { listen 80 default_server; server_name default; root /home/forge/default/public; # FORGE SSL (DO NOT REMOVE!) include logjam_fix; # ssl_certificate; # ssl_certificate_key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log on; error_log /var/log/nginx/default-error.log error; error_page 404 /index.php; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } } 

有什么数据我失踪?

尝试增加打开文件的最大数量:

 root@server $ sysctl fs.file-max=3000000000 

编辑:

您通常可以通过将该行添加到/etc/sysctl.conf来使这些更改永久/etc/sysctl.conf

 fs.file-max=3000000000