Related
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
I have stacked with permission denied on my php site. I have tried lot of different configuration but no luck. I am using nginx 1.16, php 7.4 centos . Right now I have disable SELinux and rest configuration:
Nginx runs with user nginx.
Site permissions folders have 775 permissions and files 664. For both of these owner is my user and group is nginx.
Php-fpm :
user: myuser,
group: nginx,
owneruser: nginx,
ownergroup: nginx,
mode : 0660
I am trying to access a simple test.php file that echoes "hello".
My browser shows a white screen with 404 error and the log files show permission denied.
UPDATE
I tested with a test.html page and still got permission denied so I guess it is not something with php but something with nginx.
Below are excerpts from access and error.log accordingly:
Access log excerpt:
176.92.20.33 - - [17/Dec/2020:06:56:32 +0200] "GET /test.html HTTP/1.1" 404 153 "-" "Mozilla/5.0 (Android 10; Mobile; rv:84.0) Gecko/84.0 Firefox/84.0" "-"
Error Log excerpt:
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxx/www/test.html" failed (13: Permission denied), client: 176.92.20.33, server: acropolismuseumkids.gr, request: "GET /test.html HTTP/1.1", host: "xxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/index.php" failed (13: Permission denied), client: 176.92.20.33, server: xxxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/404.html" failed (13: Permission denied), client: 176.92.20.33, server: xxxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/404.html" failed (13: Permission denied), client: 176.92.20.33, server: xxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/index.php" failed (13: Permission denied), client: 176.92.20.33, server: xxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxx"
Any help is appreciated.
Well It seems I had made a studipd mistake.
I has misstyped the cgi gateway on nginx and php-fpm configuration files.
These two should be the same.
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;
}
}
My system OS is MacOS10.13. The default PHP version is 7.1.16.
I use phpbrew to manage the PHP version. And I installed the php5.6.When I use command phpbrew switch php5.6. Then I use the commandphp -v
Then it outputs:
PHP 5.6.30 (cli) (built: May 14 2019 18:30:16)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Then I use the commandphp-fpm -v
output:
PHP 7.1.16 (fpm-fcgi) (built: Mar 31 2018 03:00:16)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
The php version in terminal is php5.6, and in the web, the version is php7.1
The php-fpm default path is in /usr/sbin.
When I try to replace the php-fpm, the web page is 404. The nginx error.log is in here.
2019/05/15 18:35:48 [error] 3125#0: *51 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
2019/05/15 18:35:48 [error] 3125#0: *51 open() "/usr/local/Cellar/nginx/1.15.12/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
2019/05/15 18:35:48 [error] 3125#0: *51 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
2019/05/15 18:35:48 [error] 3125#0: *51 open() "/usr/local/Cellar/nginx/1.15.12/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
ailed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
2019/05/15 18:48:03 [error] 3125#0: *64 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
2019/05/15 18:48:03 [error] 3125#0: *64 open() "/usr/local/Cellar/nginx/1.15.12/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:82"
I want to use php5.6.
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"