我不是nginx服务器和fpm的专家,我突然多次出现此错误,但我无法确定导致此问题的原因:
我在服务器上运行
Intel Xeon D - 32 GB RAM - 2 x2TB RAID SOFT - 连接速度1 Gbps
2017/12/06 23:37:58 [error] 20819#20819: *1 connect() to
unix:/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable)
while connecting to upstream, client: 62.33.147.332, server: domainname.com, request: "POST /checkstatus HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "domainname.com", referrer: "https://domainname.com/adminpanel/live"
这是我的nginx配置文件:
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
# the IP(s) on which your node server is running. I chose port 3000.
upstream nfb_notify {
server 127.0.0.1:8080;
keepalive 8;
}
server {
# SSL configuration
#
listen 443 ssl http2 default_server ;
listen [::]:443 ssl http2 default_server ;
ssl_certificate /etc/nginx/ssl/domainname.com/ssl-bundle.crt;
ssl_certificate_key /etc/nginx/ssl/domainname.com/domainname.key;
ssl_dhparam /etc/nginx/ssl/domainname.com/dhparam.pem;
client_max_body_size 128M;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
#root /var/www/tdsteam/webu/public;
root /home/tdsteam/webu/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name domainname.com;
gzip on;
gzip_types application/vnd.apple.mpegurl;
gzip_min_length 20;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
# Notification Service
location ~ /(notification|socket.io)/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://nfb_notify;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~ /playlists/.m3u8$ {
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:8080;
# With php7.0-fpm:
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 180;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
listen 80;
listen [::]:80;
#
server_name server3.roolink.net;
#
root /var/www/html;
index index.html index.php;
#
location / {
try_files $uri $uri/ =404;
}
}
server {
listen 80;
listen [::]:80;
server_name domainname.com;
return 301 https://$server_name$request_uri;
}
我尝试了以下解决方案,但没有奏效。 https://stackoverflow.com/a/10470827/2873860
对我的服务器的任何请求都将返回502 Bad Gateway
这是php-fpm7 log
root@server3:/var/log# tail -f php7.0-fpm.log
[07-Dec-2017 00:22:03] NOTICE: fpm is running, pid 23627
[07-Dec-2017 00:22:03] NOTICE: ready to handle connections
[07-Dec-2017 00:22:03] NOTICE: systemd monitor interval set to 10000ms
[07-Dec-2017 00:41:28] NOTICE: Terminating ...
[07-Dec-2017 00:41:28] NOTICE: exiting, bye-bye!
[07-Dec-2017 00:41:28] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful
[07-Dec-2017 00:41:28] NOTICE: fpm is running, pid 24735
[07-Dec-2017 00:41:28] NOTICE: ready to handle connections
[07-Dec-2017 00:41:28] NOTICE: systemd monitor interval set to 10000ms
[07-Dec-2017 00:41:28] NOTICE: fpm is running, pid 24735
[07-Dec-2017 00:41:28] NOTICE: ready to handle connections
[07-Dec-2017 00:41:28] NOTICE: systemd monitor interval set to 10000ms
当我重新启动fpm时网站重新启动而没有任何错误:
systemctl restart php7.0-fpm.service
但是一旦我访问了我的网页
https://mydomainname.com/live.php
如何使用一些连接到套接字的javascript代码的php会导致整个服务器崩溃?有可能吗?
服务器关闭,错误502