How to reduce size of error.log in Nginx? - nginx

I have no idea how to fix this...
2019/01/14 05:15:02 [alert] 27307#27307: *9 write() to "/var/log/nginx/access.log" failed (28: No space left on device) while logging request, client: 108.162.226.175, server: titomi.cf, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock", host: "titomi.cf"
2019/01/14 05:15:22 [error] 27307#27307: *11 FastCGI sent in stderr: "PHP message: PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/test/lib/common.lib.php on line 1443" while reading response header from upstream, client: 162.158.118.78, server: test.titomi.cf, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "test.titomi.cf"
I think this is access.log error size
How can I reduce the size of access.log?

You probably need log rotation to rotate the logs.
sudo vim /etc/logrotate.d/nginx
/var/log/nginx/*.log {
daily
missingok
rotate 14
compress
notifempty
create 0640 www-data adm
}
Daily: Rotate the logs daily basis
missingok: Do not give output if log is missing
Rotate 14: Will keep the last 14 logs
Compress: Will the compress the old copies of the log files.
You can run the logrotate
logrotate /var/log/nginx/

Related

NGinx: connect() to unix:/var/run/hhvm/sock failed, No such file

I am Tryig to install FB-CTF which uses HHVM, and NGinx. Everything is set completely by Shell command itself.. but now error log showing
2017/01/18 21:48:17 [crit] 15143#0:
***6 connect() to unix:/var/run/hhvm/sock failed**
(2: No such file or directory) while connecting to upstream,
client: 127.0.0.1, server: ,
request: "GET / HTTP/1.1",
upstream: "fastcgi://unix:/var/run/hhvm/sock:",
host: "localhost"
actually /var/run/hhvm/ contains only hhvm.hhbc.. getting 502 BAD GATEWAY
I reinstalled HHVM. then missing files are reinstalled. all the dependent files are correctly restored.

HHVM 502 gateway error on high load

I have a codebase that's running fine con HHVM.
I'm realizing some load tests with apache ab tool but when i test with 100 concurrent requests I start to get 502 gateway errors.
I generally only get two types of logs in nginx's error log:
2015/01/10 09:42:48 [crit] 29794#0: *302 connect() to
unix:/var/run/hhvm/hhvm.sock failed (2: No such file or directory)
while connecting to upstream, client: 192.168.56.211, server: ,
request: "GET /api/v2/checkaccess HTTP/1.1", upstream:
"fastcgi://unix:/var/run/hhvm/hhvm.sock:", host: "instela.com"
2015/01/10 09:42:26 [error] 29794#0: *264 connect() to
unix:/var/run/hhvm/hhvm.sock failed (111: Connection refused) while
connecting to upstream, client: 192.168.56.211, server: , request:
"GET /api/v2/checkaccess HTTP/1.1", upstream:
"fastcgi://unix:/var/run/hhvm/hhvm.sock:", host: "instela.com"
Under high load this error occurs on all load balanced backends servers, so it's not a server specific problem (I hope)
Mostly after some time HHVM returns back but many times I had to restart the daemon to bring the server back.
I am using the default configuration mostly. Here I've my configuration: http://pastie.org/9823561

765 recv() failed (104: Connection reset by peer) while reading response header from upstream

2014/03/31 23:06:50 [error] 25914#0: *765 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 173.77.251.136, server: wiki.resonant-rise.com, request: "POST /index.php?title=Chisel&action=submit HTTP/1.1", upstream: "fastcgi://127.0.0.1:9016", host: "wiki.resonant-rise.com", referrer: "http://wiki.resonant-rise.com/index.php?title=Chisel&action=edit"
2014/03/31 23:06:50 [error] 25914#0: *765 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 173.77.251.136, server: wiki.resonant-rise.com, request: "POST /index.php?title=Chisel&action=submit HTTP/1.1", upstream: "fastcgi://127.0.0.1:9016", host: "wiki.resonant-rise.com", referrer: "http://wiki.resonant-rise.com/index.php?title=Chisel&action=edit"
I have a mediawiki installation and an IPB installation. They both through up errors but this one error from mediawiki prevents me from posting semi-large articles. I have tried a lot of the solutions out there, adding catch_workers_output = yes, adjusting pm.* settings. Still not able to resolve this issue. I am coming to my wits end trying to figure this one out.
PHP-FPM Conf
http://pastie.org/private/aczklc52ll9yv0uz5drcqg
PHP-FPM WWW.CONF
http://pastie.org/private/wod3xipxhm8ractksw7ha
NGINX VHOST for MEDIAWIKI
http://pastie.org/private/h9co8aykbdmfzk2bd5qq
If the failure depends on size of the pages, it has to do with how much work the operation causes. My wild guess would be: increase the timeout (you currently have send_timeout 60s;).
It's easy for the parse time of a very long page to go over 60 seconds, especially if you're on a low power server, have not tuned performance or have enabled heavy parser extensions.
in my case it was that the php version of the project was different with the version of php I had been

Symfony2 and nginx web host

Hello i installed symfony2 on my nginx web host but it densest show up the project I've done
http://www.instelamrketing.es its the website and i used this commands to configure the server
http://www.leaseweblabs.com/2013/05/symfony2-under-nginx-on-ubuntu-12-04/
here some error logs
tail -f logs/error_log
#4 /home/intelmarketing.es/public_html/app/cache/prod/classes.php(5519): Monolog\Logger->addRecord(500, 'Uncaught PHP Ex...', Array)
#5 /home/intelmarketing.es/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionL in /home/intelmarketing.es/public_html/app/cache/prod/classes.php on line 5141" while reading response header from upstream, client: 180.211.176.176, server: intelmarketing.es, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9007", host: "www.intelmarketing.es"
2013/08/14 18:15:05 [error] 2583#0: *3 FastCGI sent in stderr: "PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "C:/wamp/www/symfony/app/logs/prod.log" could not be opened: failed to open stream: No such file or directory' in /home/intelmarketing.es/public_html/app/cache/prod/classes.php:5141
Stack trace:
#0 /home/intelmarketing.es/public_html/app/cache/prod/classes.php(5089): Monolog\Handler\StreamHandler->write(Array)
#1 /home/intelmarketing.es/public_html/app/cache/prod/classes.php(5018): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /home/intelmarketing.es/public_html/app/cache/prod/classes.php(5204): Monolog\Handler\AbstractHandler->handleBatch(Array)
#3 /home/intelmarketing.es/public_html/app/cache/prod/classes.php(5419): Monolog\Handler\FingersCrossedHandler->handle(Array)
#4 /home/intelmarketing.es/public_html/app/cache/prod/classes.php(5519): Monolog\Logger->addRecord(500, 'Uncaught PHP Ex...', Array)
#5 /home/intelmarketing.es/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionL in /home/intelmarketing.es/public_html/app/cache/prod/classes.php on line 5141" while reading response header from upstream, client: 180.211.176.176, server: intelmarketing.es, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9007", host: "www.intelmarketing.es"
what might be the problem?
Thank you
/Aleksandar!
Clear your app/logs and app/cache directories and give your web server permissions to write to them (read the installation chapter). You left there some files from your development machine.

502 Bad Gateway error with nginx and unicorn

I have nginx 1.4.1 and unicorn set up on centos - I am getting a 502 Bad Gateway error and my nginx logs shows this:
1 connect() to unix:/tmp/unicorn.pantry.sock failed (2: No such file or directory)
while connecting to upstream, client: 192.168.1.192, server: , request: "GET / HTTP/1.1",
upstream: "http://unix:/tmp/unicorn.pantry.sock:/", host: "192.168.1.30"
There is no /tmp/unicorn.pantry.sock file or directory. I am thinking that it might be a permission error and therefore the file can't be written if so who requires what permission - I have also read that I can create a tcp client
Also I don't understand where the 192.168.1.192 comes from
I just want to make it work How can I do it?
Ok I figured this out. I had unicorn.sock in my shared directory so I needed to point unix: to it

Resources