Manually adding swap and activating on linux

Create swapfile

sudo install -o root -g root -m 0600 /dev/null /swapfile

Write out a 4GB file named ‘swapfile’

dd if=/dev/zero of=/swapfile bs=1k count=4096k

Let linux know about swap file

mkswap /swapfile

Activate

swapon /swapfile

activate swap also after boot. Add to the file system table

echo "/swapfile       swap    swap    auto      0       0" | sudo tee -a /etc/fstab
Tags 
swap linux

Invision forum lighttpd rewrite rules

$HTTP["host"] =~ "exampledomain.tld" {
server.document-root = "/var/www/replacedomain/public_html/"
server.error-handler-404 = "/index.php"
dir-listing.activate = "disable"
url.rewrite-final = (
"^/(sitemap.xml)" => "$0",
  "^/(.*).(.*)" => "$0",
  "^/(.*).(css|js|gif|jpg|png)$" => "$0",
   "^/(images|javascript|style)(.*)$" => "$0",
    "^/(.+)/?$" => "/index.php/$1"
)

}

Be sure to keep handler-404 when you have apps installed like classifieds

Nginx tuning for best perfomance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

Tags 
nginx

Reverse proxy in haproxy

We will try something roughly equivalent to the following ProxyPass directives in Apache2:

ServerName www.example.com
...
ProxyPass        /foo/  http://foo.local
ProxyPassReverse /foo/  http://foo.local

In haproxy.cfg define a backend named foo, to reverse-proxy to foo.local backend server.

Tags 
haproxy

Proftpd sftp setup on centos

Setting up

yum install proftpd
cd ~/
wget https://gist.github.com/raw/4296200/proftpd.conf.patch
cd /etc/
patch < ~/proftpd.conf.patch 
touch /etc/proftpd.sftp.passwd
chown nobody:nobody /etc/proftpd.sftp.passwd
chmod 600 /etc/proftpd.sftp.passwd
cd ~/
wget http://www.castaglia.org/proftpd/contrib/ftpasswd

Nginx and Ajenti on ubuntu

Install Ajenti

apt-get update
wget http://repo.ajenti.org/debian/key -O- | apt-key add -
echo "deb http://repo.ajenti.org/ng/debian main main ubuntu" >> /etc/apt/sources.list
apt-get update
apt-get install ajenti
service ajenti restart

Install Ajenti-v

apt-get install ajenti-v ajenti-v-nginx ajenti-v-mysql ajenti-v-php-fpm php-mysql 

If <3 Ruby

PHP7.2 Nginx and PHP7.2-FPM on Ubuntu 16.04

Install software-properties-common

sudo apt-get install -y software-properties-common

Install latest nginx version from community maintained ppa

sudo add-apt-repository ppa:nginx/stable

Update packages after adding ppa

sudo apt-get update

Install nginx

sudo apt-get install -y nginx

Check status

sudo service nginx

Start nginx if it is not already running

sudo service nginx start
Tags 
nginx php72 fpm