nginx's php-cgi closing/crashing due to ajax calls - php
I have just set up nginx on my website and when ever visitors are visiting the php-cgi.exe and the website is becoming very slow, and I am unsure if it is loading at all. nginx.exe is still running as a service from what I can see. Below is my error log (same sort of messages every time), I think they are to do with ajax calls, I am very confused on why it is doing this, and how I can fix it.
Errors:
2015/09/27 09:42:58 [error] 800#3404: *334 WSASend() failed (10054: An existing connection was forcibly closed by the remote host) while sending request to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147307 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *311 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147305 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *305 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147304 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *310 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147306 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:42:58 [error] 800#3404: *324 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147303 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
After php-cgi.exe closes, I start receiving these errors
2015/09/27 09:43:58 [error] 800#3404: *323 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147308 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:43:58 [error] 800#3404: *334 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147309 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:43:58 [error] 800#3404: *324 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147310 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:43:58 [error] 800#3404: *305 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147311 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:43:58 [error] 800#3404: *311 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443372147312 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/27 09:43:58 [error] 800#3404: *310 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443372147313 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
Stopping and starting nginx fixes it for another 5 minutes untill about 15 ajax calls are made untill it crashes again!!? An ajax call is called ever 1 second to update a chatbox
Ajax:
function loadMessages()
{
$.ajax({
type: "GET",
url: '<?php echo $config['website']['url']; ?>/assets/hk/ajax/staff_messages.php',
success: function(data) {
if (staffContent != data)
{
var div = document.getElementById('staffmessagesArea');
div.innerHTML = data;
staffContent = data;
updateScroll();
}
}
});
setTimeout(loadMessages,1000);
}
Ajax call page:
<?php
require_once '../../other/connection.php';
global $pdo;
$stmt = $pdo->prepare("SELECT * FROM `craft_hk_messages` ORDER BY `When`");
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($rows as $row)
{
if ($row['Sender'] == $_SESSION['user']['username'])
{
echo '<div class="col-md-12"><div style="height:40px;background-color:#B5B5B5;padding:14px;padding-top:10px;border-radius:4px;color:white;float:right;margin-bottom:20px;">' . $row['Message'] . '</div><br></div>';
}
else
{
$figure = "https://game.boon.pw/habbo-imaging/avatarimage.php?figure=".$_SESSION['user']['look']."&action=wav&direction=2&head_direction=3&gesture=sml&size=m&headonly=1";
echo '<div class="col-md-2" style="min-height:50px !important;
background-image:url(\''; echo $figure . '\');background-size: 50px 50px;background-repeat:no-repeat;">
</div><div class="col-md-10" style="margin-left:-60px;"><div style="border-radius:4px;height:40px;background-color:#0094FF;padding:14px;padding-top:10px;color:white;width: auto;float:left;
margin-bottom:20px;
position: relative;">'.$row['Sender'].': ' . $row['Message'] . '</div></div>';
}
}
?>
</thead>
<tbody>
</tbody>
</table>
Nginx config:
worker_processes 4; # 2 * Number of CPUs
events {
worker_connections 19000; # It's the key to high performance - have a lot of connections available
}
worker_rlimit_nofile 20000; # Each connection needs a filehandle (or 2 if you are proxying)
# Total amount of users you can serve = worker_processes * worker_connections
http {
include mime.types;
default_type application/octet-stream;
#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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 15;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
rewrite ^/(|/)$ /index.php?page=$1;
rewrite ^/([a-zA-Z0-9_-]+)(|/)$ /index.php?page=$1;
rewrite ^/(.*).htm$ /$1.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /404.php
#
error_page 500 502 503 504 /404.php;
location = /404.php {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_read_timeout 60000s;
fastcgi_param SCRIPT_FILENAME C:/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
The ajax calls keep going even when php-cgi close though, but you can't reload as the website will display as offline.
edit4 log update:
2015/09/28 11:40:27 [emerg] 2280#948: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
2015/09/28 11:43:46 [error] 2612#2276: *4 CreateFile() "C:\nginx/html/index" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /index HTTP/1.1", host: "158.69.21.193"
2015/09/28 11:43:46 [error] 2612#2276: *4 CreateFile() "C:\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/index"
2015/09/28 11:43:53 [error] 2612#2276: *4 CreateFile() "C:\nginx/html/starter-template.css" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /starter-template.css HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/index.php?page=index"
2015/09/28 11:45:10 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/starter-template.css" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /starter-template.css HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/index"
2015/09/28 11:45:21 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/assets/website/images/bg_hotel.out.png" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/website/images/bg_hotel.out.png HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/home"
2015/09/28 11:45:36 [error] 1712#2324: *2 CreateFile() "C:\nginx/html/assets/website/images/bg_hotel.out.png" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/website/images/bg_hotel.out.png HTTP/1.1", host: "158.69.21.193", referrer: "http://158.69.21.193/account"
2015/09/28 11:46:22 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/hk/index" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /hk/index HTTP/1.1", host: "158.69.21.193"
2015/09/28 11:47:08 [error] 1712#2324: *16 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991116 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *16 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991116 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *39 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991119 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *39 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991119 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *1 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991117 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *1 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991117 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *27 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991118 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *27 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991118 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *2 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991120 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:47:08 [error] 1712#2324: *2 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991120 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *40 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991121 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *40 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991121 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *16 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991122 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *16 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991122 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *39 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991123 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *39 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991123 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *517 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991124 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *517 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991124 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *27 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991125 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *27 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/recent_logins.php?_=1443465991125 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *2 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991126 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
2015/09/28 11:48:08 [error] 1712#2324: *2 CreateFile() "C:\nginx/html/50x.html" failed (2: The system cannot find the file specified), client: 158.69.21.193, server: localhost, request: "GET /assets/hk/ajax/active_content.php?_=1443465991126 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "158.69.21.193", referrer: "http://158.69.21.193/hk/index.php?url=index"
Related
Get CannotWriteFileException when upload 120mb file on nginx server
I have a Laravel 7 project on the Ubuntu + Nginx server. I can upload files less than ~10mb, but when i am trying to upload a 120mb file I got an error. I am already changed memory_limit, upload_max_filesize, post_size to 640mb in php.ini. It did not help. I am also restart php-fpm and nginx services. ERROR LOG 2021/01/21 21:11:51 [warn] 13069#13069: *1 a client request body is buffered to a temporary file /var/lib/nginx/body/0000000001, client: 92.47.198.158, server: servername, request: "POST /courseclass/17 HTTP/2.0", host: "servername", referrer: "https://servername/courseclass/17" 2021/01/21 21:11:53 [error] 13069#13069: *1 openat() "/var/www/servername/video/class/video_course_1611240590.mp4" failed (2: No such file or directory), client: 92.47.198.158, server: servername, request: "GET /video/class/video_course_1611240590.mp4 HTTP/2.0", host: "servername", referrer: "https://servername/watch/course/6" 2021/01/21 21:11:54 [error] 13069#13069: *1 openat() "/var/www/servername/video/class/video_course_1611240590.mp4" failed (2: No such file or directory), client: 92.47.198.158, server: servername, request: "GET /video/class/video_course_1611240590.mp4 HTTP/2.0", host: "servername", referrer: "https://servername/watch/course/6" 2021/01/21 21:41:18 [error] 13069#13069: *8 openat() "/var/www/servername/images/light.jpg" failed (2: No such file or directory), client: 92.47.149.211, server: servername, request: "GET /images/light.jpg HTTP/2.0", host: "servername", referrer: "https://servername/" 2021/01/21 21:41:21 [error] 13069#13069: *8 openat() "/var/www/servername/images/light.jpg" failed (2: No such file or directory), client: 92.47.149.211, server: servername, request: "GET /images/light.jpg HTTP/2.0", host: "servername", referrer: "https://servername/" 2021/01/21 21:49:53 [warn] 13069#13069: *10 an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/3/00/0000000003 while reading upstream, client: 92.47.198.158, server: servername, request: "POST /courseclass/17 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/servername.sock:", host: "servername", referrer: "https://servername/courseclass/17"
The problem was in the less memory of the server. After I increase it from 5GB to 10GB there is no problems. But before that there was about 200MB and I tried to upload a video of 100MB
Missing minified js file in Wordpress
I have done a fresh installation of WordPress on AWS Elastic BeanStalk. I am not using the root directory. I have moved the WordPress code to the public directory. I am not able to open the page to add or edit the post/page. I am getting the below error in Nginx logs. I tried both WordPress 5.5.3 and 5.4.4 Any clue where the issue can be? 2020/12/04 12:24:47 [warn] 13851#0: *65 an upstream response is buffered to a temporary file /var/lib/nginx/tmp/fastcgi/8/00/0000000008 while reading upstream, client: 103.5.133.148, server: , request: "GET /wp-admin/post-new.php?post_type=page HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com", referrer: "http://blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com/wp-admin/upload.php" 2020/12/04 12:24:48 [error] 13851#0: *68 open() "/var/www/html/public/wp-includes/js/dist/vendor/wp-polyfill.min.js" failed (2: No such file or directory), client: 103.5.133.148, server: , request: "GET /wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.4.4 HTTP/1.1", host: "blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com", referrer: "http://blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com/wp-admin/post-new.php?post_type=page" 2020/12/04 12:24:48 [error] 13851#0: *69 open() "/var/www/html/public/wp-includes/js/dist/vendor/lodash.min.js" failed (2: No such file or directory), client: 103.5.133.148, server: , request: "GET /wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.15 HTTP/1.1", host: "blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com", referrer: "http://blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com/wp-admin/post-new.php?post_type=page" 2020/12/04 12:24:49 [error] 13851#0: *68 open() "/var/www/html/public/wp-includes/js/dist/vendor/react.min.js" failed (2: No such file or directory), client: 103.5.133.148, server: , request: "GET /wp-includes/js/dist/vendor/react.min.js?ver=16.9.0 HTTP/1.1", host: "blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com", referrer: "http://blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com/wp-admin/post-new.php?post_type=page" 2020/12/04 12:24:49 [error] 13851#0: *69 open() "/var/www/html/public/wp-includes/js/dist/vendor/react-dom.min.js" failed (2: No such file or directory), client: 103.5.133.148, server: , request: "GET /wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0 HTTP/1.1", host: "blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com", referrer: "http://blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com/wp-admin/post-new.php?post_type=page" 2020/12/04 12:24:49 [error] 13851#0: *72 open() "/var/www/html/public/wp-includes/js/dist/vendor/moment.min.js" failed (2: No such file or directory), client: 103.5.133.148, server: , request: "GET /wp-includes/js/dist/vendor/moment.min.js?ver=2.22.2 HTTP/1.1", host: "blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com", referrer: "http://blog-env.eba-gnu2jhwn.us-east-1.elasticbeanstalk.com/wp-admin/post-new.php?post_type=page"
The issue was caused by git. I am using composer with WordPress, so had added the 'vendor/' entry in the .gitignore file. Because of this none of the vendor folders were getting shipped to the server and hence the missing files. I changed 'vendor/' to '/vendor' in .gitignore file. Ran 'git rm -r --cached .' and committed the code again. It works now.
Why do I get 403 forbidden when deploying laravel project with nginx?
I tried many answers from SO and other sites online but I can't seem to get it to work. I get 403 forbidden error when deploying my laravel project with nginx config: server { listen 80; server_name xxxxx.co www.xxxxx.co; return 301 https://xxxxx.co$request_uri; } server { listen 80; listen [::]:80; listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/www.xxxxx.co/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/www.xxxxx.co/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot root /var/www/www.xxxxx.co/public; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name xxxxx.co www.xxxxx.co; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. # try_files $uri $uri/ =404; try_files $uri $uri/ /index.php?$query_string; } } where /var/www/www.xxxxx.co/public has this content, if matters: admin favicon.ico home index.php web.config On local machine, it works fine and I see the home page, but with nginx I can't make it work EDIT 1: Here are permissions on /var/www/www.xxxxx.co drwxr-xr-x 13 root root 4096 Oct 10 07:48 . Here are the logs from /var/log/nginx/domains/main.xxxxx.co.error.log 2020/10/10 08:19:39 [error] 19736#19736: *9 directory index of "/var/www/www.xxxxx.co/public/home/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET /home/ HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:20:31 [error] 19736#19736: *9 open() "/var/www/www.xxxxx.co/public/login" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET /login HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:20:35 [error] 19736#19736: *9 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:22:03 [error] 19776#19776: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:22:04 [error] 19776#19776: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:24:03 [error] 19825#19825: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:25:31 [error] 19857#19857: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:25:36 [error] 19857#19857: *3 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:26:24 [error] 19873#19873: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:29:14 [error] 19908#19908: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:31:44 [error] 19937#19937: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:31:48 [error] 19937#19937: *1 directory index of "/var/www/www.xxxxx.co/public/home/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET /home/ HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:34:21 [error] 19968#19968: *1 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:36:24 [error] 19968#19968: *3 directory index of "/var/www/www.xxxxx.co/public/" is forbidden, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:38:46 [error] 20024#20024: *2 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:38:50 [error] 20024#20024: *2 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET /home/ HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:39:43 [error] 20024#20024: *2 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:40:23 [error] 20024#20024: *2 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET /index HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:40:26 [error] 20024#20024: *2 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET /home/ HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:53:32 [error] 20220#20220: *36 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:53:46 [error] 20220#20220: *36 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET /index HTTP/1.1", host: "xxxxx.co" 2020/10/10 08:53:50 [error] 20220#20220: *41 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET /index HTTP/1.1", host: "www.xxxxx.co" 2020/10/10 08:54:19 [error] 20220#20220: *42 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET /index HTTP/1.1", host: "www.xxxxx.co" 2020/10/10 08:54:22 [error] 20244#20244: *1 open() "/var/www/www.xxxxx.co/publicindex.php" failed (2: No such file or directory), client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", host: "www.xxxxx.co" 2020/10/10 09:03:03 [crit] 20322#20322: *2 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstrea>2020/10/10 09:05:47 [crit] 20394#20394: *2 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstrea>2020/10/10 09:05:48 [crit] 20394#20394: *2 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstrea>2020/10/10 13:30:47 [crit] 20394#20394: *224 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.201, server: www.xxxxx.co, request: "GET /ads.txt HTTP/1.1">2020/10/10 13:54:08 [crit] 20394#20394: *257 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 195.154.61.206, server: www.xxxxx.co, request: "GET / HTTP/1.1", upst>2020/10/10 13:57:53 [crit] 20394#20394: *265 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 195.154.61.206, server: www.xxxxx.co, request: "GET / HTTP/1.1", upst>2020/10/10 15:15:46 [crit] 20394#20394: *350 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.203, server: www.xxxxx.co, request: "GET /ads.txt HTTP/1.1">2020/10/10 15:38:08 [crit] 20394#20394: *385 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 62.210.10.77, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstre>2020/10/10 15:38:28 [crit] 20394#20394: *387 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 195.154.63.222, server: www.xxxxx.co, request: "GET / HTTP/1.1", upst>2020/10/10 17:52:32 [crit] 20394#20394: *629 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.94, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstre>2020/10/10 20:00:52 [crit] 20394#20394: *848 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.201, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstr>2020/10/10 21:00:50 [crit] 20394#20394: *900 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.95, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstre>2020/10/10 22:00:32 [crit] 20394#20394: *988 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.205, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstr>2020/10/10 23:22:15 [crit] 20394#20394: *1098 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 182.66.43.161, server: www.xxxxx.co, request: "GET / HTTP/1.1", upst>2020/10/11 00:01:52 [crit] 20394#20394: *1165 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.203, server: www.xxxxx.co, request: "GET / HTTP/1.1", upst>2020/10/11 04:40:28 [crit] 20394#20394: *1609 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 77.30.211.212, server: www.xxxxx.co, request: "GET / HTTP/1.1", upst>2020/10/11 05:32:53 [crit] 20394#20394: *1685 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.205, server: www.xxxxx.co, request: "GET / HTTP/1.1", upst>2020/10/11 08:56:03 [crit] 20394#20394: *1948 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.205, server: www.xxxxx.co, request: "GET /en/desert-one HT>2020/10/11 09:30:17 [crit] 20394#20394: *1994 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 167.172.56.36, server: www.xxxxx.co, request: "GET /wp-login.php HTT>2020/10/11 11:43:53 [crit] 20394#20394: *2149 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 18.162.245.185, server: www.xxxxx.co, request: "GET /wp-login.php HT>2020/10/11 13:16:09 [crit] 20394#20394: *2324 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 66.249.66.201, server: www.xxxxx.co, request: "GET /ads.txt HTTP/1.1>2020/10/11 13:41:01 [crit] 20394#20394: *2343 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 94.49.72.36, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstre>2020/10/11 13:50:54 [crit] 28196#28196: *1 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 94.49.72.36, server: www.xxxxx.co, request: "GET / HTTP/1.1", upstream:>
Finally fixed it. Comment from #Ivan Shatsky made me search about PHP-FPM. I found it was important and most examples online didn't include it in config. I installed it via: sudo apt-get update sudo apt-get install php7.4-cli php7.4-curl php7.4-mysql php7.4-fpm php7.4-gd php7.4-xml php7.4-mbstring php7.4-zip php7.4-soap php7.4-dev -y I faced other issues but finally got it working with this config: server { listen 80; server_name www.xxxxx.co xxxxx.co; return 301 https://www.xxxxx.co$request_uri; } server { listen 80; listen [::]:80; listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/www.xxxxx.co/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/www.xxxxx.co/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot server_name www.xxxxx.co xxxxx.co; root /var/www/www.xxxxx.co/public; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php$is_args$args; } # pass the PHP scripts to FastCGI server listening on /var/run/php7.4-fpm.sock location ~ \.php$ { try_files $uri /index.php =404; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
PHP-FPM and Nginx: "Resource temporarily unavailable" errors in proxy_error_log
I found the following discussion that was posted 4 years ago: 502 Gateway Errors under High Load (nginx/php-fpm) Where someone had a similar issue as mine, but unfortunately I believe that the configurations he received were customized for his own server specs and I can't use the same configuration on my server. Anyway I would like to present the problem I have by myself and not to just tell you to go to the link I sent and read someone else's problem. So to my own story - I have a big social media page where I post links to my website articles, which means that I have lots of traffic spikes during the day each time I share something. Recently I noticed that the site is too slow and sometimes not loading at all and unfortunately I am not very familiar in solving issues like this and I don't have a system administrator who manages my dedicated server to contact with since I rent it from OVH which offers unmanaged servers in low cost. The server has pretty good specs and this issue happens even when there are 100 active users on site. I can also see some errors in my server logs. Server specs are the following: AMD Opteron(tm) Processor 4334, AMD Opteron(tm) Processor 4334 (6 core(s)) SoftRaid 3x160GB SSD 32GB RAM 1Gbps connection CentOS x64 Linux release 7.2.1511 (Core) Plesk v12.5.30 The errors I was talking about: proxy_error_log 2016/10/02 09:49:36 [error] 6931#0: *469804 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2607:5300:60:5e68::, server: ###.com, request: "POST /wp-cron.php?doing_wp_cron=1475416176.6522459983825683593750 HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://www.###.com/wp-cron.php?doing_wp_cron=1475416176.6522459983825683593750" 2016/10/02 09:49:36 [error] 6931#0: *469806 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2607:5300:60:5e68::, server: ###.com, request: "POST /wp-cron.php?doing_wp_cron=1475416176.8384990692138671875000 HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://www.###.com/wp-cron.php?doing_wp_cron=1475416176.8384990692138671875000" 2016/10/02 09:49:38 [error] 6931#0: *469826 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 73.77.251.156, server: ###.com, request: "GET /###/ HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://m.facebook.com/" 2016/10/02 09:49:38 [error] 6931#0: *469830 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 217.123.129.73, server: ###.com, request: "GET /###/ HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://m.facebook.com/" 2016/10/02 09:49:39 [error] 6931#0: *469840 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2607:5300:60:5e68::, server: ###.com, request: "POST /wp-cron.php?doing_wp_cron=1475416179.1317949295043945312500 HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://www.###.com/wp-cron.php?doing_wp_cron=1475416179.1317949295043945312500" 2016/10/02 09:49:39 [error] 6931#0: *469842 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2605:6001:f08a:3400:88d6:8b94:4499:8e36, server: ###.com, request: "GET /###/ HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://m.facebook.com/" 2016/10/02 09:49:39 [error] 6931#0: *469845 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 162.158.75.61, server: ###.com, request: "GET /###/ HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://m.facebook.com/" 2016/10/02 09:49:39 [error] 6931#0: *469847 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2607:5300:60:5e68::, server: ###.com, request: "POST /wp-cron.php?doing_wp_cron=1475416179.6054229736328125000000 HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://www.###.com/wp-cron.php?doing_wp_cron=1475416179.6054229736328125000000" 2016/10/02 09:49:39 [error] 6931#0: *469849 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2607:5300:60:5e68::, server: ###.com, request: "POST /wp-cron.php?doing_wp_cron=1475416179.6478641033172607421875 HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://www.###.com/wp-cron.php?doing_wp_cron=1475416179.6478641033172607421875" 2016/10/02 09:49:39 [error] 6931#0: *469851 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2601:81:4203:1bce:5809:b94c:4616:4730, server: ###.com, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://www.###.com/###/" 2016/10/02 09:49:40 [error] 6931#0: *469853 connect() to unix:///var/www/vhosts/system/###.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 2602:306:8b97:11a0:6843:ad77:251e:864a, server: ###.com, request: "GET /###/ HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/###.com/php-fpm.sock:", host: "www.###.com", referrer: "http://m.facebook.com/" I have tons of these ^ I will now attach some of my configuration files as the guy in the other thread I linked to did, so you will have some sort of idea on what's going on my server. php-fpm.conf include=/etc/php-fpm.d/*.conf [global] pid = /run/php-fpm/php-fpm.pid error_log = /var/log/php-fpm/error.log daemonize = no /etc/php-fpm.d/www.conf [www] listen = 127.0.0.1:9000 listen.backlog = -1 listen.allowed_clients = 127.0.0.1 user = apache group = apache pm = dynamic pm.max_children = 250 pm.start_servers = 20 pm.min_spare_servers = 20 pm.max_spare_servers = 35 pm.max_requests = 500 slowlog = /var/log/php-fpm/www-slow.log php_admin_value[error_log] = /var/log/php-fpm/www-error.log php_admin_flag[log_errors] = on php_value[session.save_handler] = files php_value[session.save_path] = /var/lib/php/session /etc/php-fpm.d/###.com.conf [###.com] prefix = /var/www/vhosts/system/$pool user = ### group = psacln listen = php-fpm.sock listen.owner = root listen.group = psaserv listen.mode = 0660 chdir = / pm = ondemand pm.max_children = 5 pm.process_idle_timeout = 10s pm.start_servers = 1 pm.min_spare_servers = 1 pm.max_spare_servers = 1 catch_workers_output = yes php_value[max_input_time] = 60 php_value[max_execution_time] = 60 php_value[memory_limit] = 128M php_value[open_basedir] = none sysctl.conf net.ipv6.conf.all.autoconf = 0 net.ipv6.conf.default.autoconf = 0 net.ipv6.conf.eth0.autoconf = 0 net.ipv6.conf.all.accept_ra = 0 net.ipv6.conf.default.accept_ra = 0 net.ipv6.conf.eth0.accept_ra = 0 net.core.somaxconn = 4096 net.ipv4.tcp_fin_timeout = 20 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_slow_start_after_idle = 0 net.ipv4.tcp_syncookies = 1 /etc/nginx/nginx.conf worker_processes 1; include /etc/nginx/modules.conf.d/*.conf; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server_tokens off; include /etc/nginx/conf.d/*.conf; } # override global parameters e.g. worker_rlimit_nofile include /etc/nginx/*global_params; /etc/security/limits.conf has no configurations, only comments inside. These are the results for the following commands: ulimit -n 1024 ulimit -Sn 1024 ulimit -Hn 4096 cat /proc/sys/fs/file-max 3266168 free -m total used free shared buff/cache available Mem: 32089 1284 3784 1718 27020 28936 Swap: 1532 1 1531 About fastcgi_params - I have no idea where to find this one on Plesk. I could only find a file with variables that I don't know their values. Like these lines for example (that's how the whole file look like): fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; I am sorry if there's something missing, I really tried to make it detailed as possible and it's also not easy to find where the configuration files are located with Plesk. I had to do some research for each file I attached above... (That's one of the reasons I don't like Plesk to be honest, but that's what I have atm) If there are any more configuration files you need me to send, please let me know and I will attach it in the comments. Please also let me know where I can find them (considering that I'm using Plesk v12.5). It's really important for me to configure the server properly for my needs and for my specs and get rid of the errors, so please help me. :) Thank you!
Try to increase your php-fpm children number, for example like this: pm.max_children = 30 pm.start_servers = 10 pm.min_spare_servers = 3 pm.max_spare_servers = 15 then sudden spikes of traffic won't generate the error
make sure you have increased php-fpm backlogs variable: listen.backlog = 100000 also increase the number of net.core.somaxconn=2000000 (kernel parameters at runtime). like this : sysctl net.core.somaxconn=200000 sysctl -p
Nginx/PHP-CGI - 502 Bad Gateway
I appear to be having an issue with my website when I browse around (just clicking links here and there), and my system would return a random 502 Bad Gateway error. I can hit the refresh button and it would appear to work fine. Error Message: 2012/08/16 11:17:54 [error] 26777#0: *1049 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 66.162.194.10, server: SITE, request: "GET /wp-admin/admin-ajax.php?action=dashboard-widgets&widget=dashboard_secondary HTTP/1.1", upstream: "fastcgi://unix:/tmp/php.socket:", host: "SITE", referrer: "SITE/wp-admin/index.php" 2012/08/16 11:17:54 [error] 26777#0: *1049 connect() failed (111: Connection refused) while connecting to upstream, client: 66.162.194.10, server: SITE, request: "GET /wp-admin/admin-ajax.php?action=dashboard-widgets&widget=dashboard_secondary HTTP/1.1", upstream: "http://127.0.0.1:9000/wp-admin/admin-ajax.php?action=dashboard-widgets&widget=dashboard_secondary", host: "SITE", referrer: "http://SITE/wp-admin/index.php" /etc/nginx/nginx.conf: user www-data; worker_processes 8;