This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rsyncpostcmd = { | |
| -- based on default rsync. | |
| default.rsyncssh, | |
| -- for this config it is important to keep maxProcesses at 1, so | |
| -- the postcmds will only be spawned after the rsync completed | |
| maxProcesses = 1, | |
| -- called whenever something is to be done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # /etc/sysctl.conf - Configuration file for setting system variables | |
| # See /etc/sysctl.d/ for additional system variables. | |
| # See sysctl.conf (5) for information. | |
| # | |
| #kernel.domainname = example.com | |
| # Uncomment the following to stop low-level messages on console | |
| #kernel.printk = 3 4 1 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # /etc/sysctl.conf - Configuration file for setting system variables | |
| # See /etc/sysctl.d/ for additional system variables. | |
| # See sysctl.conf (5) for information. | |
| # | |
| #kernel.domainname = example.com | |
| # Uncomment the following to stop low-level messages on console | |
| #kernel.printk = 3 4 1 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| It's good to test how many PHP-FPM processes a server could handle easily, first start Nginx and PHP-FPM and load some PHP pages, preferably all of the heaviest pages. Then check memory usage per PHP-FPM process example with Linux top or htop command. Let's assume that the server has 512 Mb memory and 220 Mb could be used for PHP-FPM, every process use 24 Mb RAM (some huge content management system with plugins can easily use 20-40 Mb / per PHP page request or even more). Then simply calculate the server max_children value: | |
| 220 / 24 = 9.17 | |
| So good pm.max_children value is 9. This is based just quick average and later this could be something else when you see longer time memory usage / per process. After quick testing it's much easier to setup pm.start_servers value, pm.min_spare_servers value and pm.max_spare_servers value. | |
| https://www.kinamo.be/en/support/faq/determining-the-correct-number-of-child-processes-for-php-fpm-on-nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| installimage -n app-11.example.com -b grub -r yes -l 1 -p /boot:ext2:512M,swap:swap:4G,/:ext4:all -d sda,sdb -s en -t yes -K https://gist.githubusercontent.com/username/4973306c6d7ff53c1/raw/0322d9f18b7979f997a959e8ec4b1980723346f4/id_rsa.pub -i /root/.oldroot/nfs/install/../images/Debian-89-jessie-64-minimal.tar.gz -a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Advanced config for NGINX | |
| server_tokens off; | |
| add_header X-XSS-Protection "1; mode=block"; | |
| add_header X-Content-Type-Options nosniff; | |
| # Redirect all HTTP traffic to HTTPS | |
| server { | |
| listen 80; | |
| server_name www.domain.com domain.com; | |
| return 301 https://$host$request_uri; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import urllib.request | |
| import re | |
| import ssl | |
| import sys | |
| # # find generic mirrors | |
| mirrors = urllib.request.urlopen('http://www.debian.org/mirror/list') | |
| https = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /var/log/myproject/celery.log { | |
| size 1 | |
| su myuser myuser | |
| copytruncate | |
| create | |
| rotate 10 | |
| missingok | |
| postrotate | |
| timeext=`date -d '1 day ago' "+%Y-%m-%d"` # daily | |
| # timeext=$(date +%Y-%m-%d_%H) # hourly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; | |
| do | |
| [ -f $CPUFREQ ] || continue | |
| echo -n performance > $CPUFREQ | |
| done | |
| https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt |