Later Ctrl + ↑

How to fix issue when Munin doesn’t zoom/show graphs by day

For nginx:

sudo apt-get install spawn-fcgi libcgi-fast-perl libapache2-mod-fcgid
sudo spawn-fcgi -s /var/run/munin/fcgi-graph.sock -U www-data -u www-data -g www-data /usr/lib/munin/cgi/munin-cgi-graph

For Apache2:

sudo apt-get install libapache2-mod-fcgid
sudo a2enmod fcgid
sudo service apache2 restart

How to get list all user agents ordered by the number of times they appear from access.log

awk -F\" '{print $6}' access.log | sort | uniq -c | sort -bg

Response example:

  46547 Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
  89768 API/1.0 (+Legacy)
 104304 Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
 133439 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
 149988 Mozilla/5.0 (compatible; YandexBot/3.0; +
 400785 Bad Bot

How to block UserAgent with nginx

Open host file:

sudo mcedit /etc/nginx/sites-available/...

And put into server section condition:

if ($http_user_agent ~* (BadUserAgent) ) {
    return 404;

Where “BadUserAgent” change to what you want.

Do you want to block multiple UserAgents? Use this:

if ($http_user_agent ~* (BadUserAgentFirst|BadUserAgentSecond|BadUserAgentNext) ) {
    return 404;

At last, check nginx configuration and reload it if it’s ok:

sudo nginx -t
sudo service nginx reload

How to turn off monitoring and saving CHMOD in Git

Main command:

git config --global core.fileMode false

Unfortunately, it will be working for new cloned repositories only. Why? Because, when you cloned repositories earlier, Git placed the choice “fileMode = true” in their files of a configuration. And now you need to use this command in every cloned repository for fully fixing CHMOD issue:

cd your_first_repository/
git config --unset core.fileMode
cd your_second_repository/
git config --unset core.fileMode
... and next

Now, earlier cloned repositories will use the global configuration at the beginning of this instruction.

Earlier Ctrl + ↓