VPS - cllu/.rc GitHub Wiki

PHP

$ apt-get install php5-fpm
$ apt-get install php5-pear libpcre3-dev build-essential
$ pecl install apc
$ cat extension=apc.so > /etc/php5/conf.d/apc.ini

504 Gateway Time-out

Set request_terminate_timeout=30s in /etc/php5/fpm/pool.d/www.conf for php5-fpm.

credit: http://serverfault.com/a/179136/229918

File upload limit

Ensure /etc/php5/fpm/php.ini has the following settings:

upload_max_filesize = 100M
post_max_size = 100M

Ensure Nginx has the following settings:

http {
	#...
        client_max_body_size 100m;
	#...
}

Move MySQL datadir

Stop MySQL using the following command:

$ sudo service mysql stop
$ sudo cp -R -p /var/lib/mysql /srv/db/
$ # change `datadir` in file /etc/mysql/my.cnf, from `/var/lib/mysql` to `/srv/db/mysql`
$ # replace all `/var/lib/mysql` with `/srv/db/mysql` in `/etc/apparmor.d/usr.sbin.mysqld`
$ sudo /etc/init.d/apparmor reload
$ sudo service mysql restart

Start MySQL automatically

sudo update-rc.d mysql defaults

MySQL crashes all the time, may due to the default buffer size. add the following line to /etc/mysql/my.cnf:

innodb_buffer_pool_size = 32M

Secure SSH

Use a non-default port:

Ensure the following settings in /etc/ssh/sshd_config, and restart ssh server.

PermitRootLogin no
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM yes