LNMH
Linux
Version :ubuntu 14.04
更新源:
apt-get update
echo 4096 >/proc/sys/net/core/somaxconn
echo never > /sys/kernel/mm/transparent_hugepage/enabled
修改时区:
echo Asia/Shanghai /etc/timezone
sudo dpkg-reconfigure tzdata
修改 /etc/sysctl.conf:
net.ipv4.tcp_tw_reuse =1
net.ipv4.tcp_tw_recycle =1
net.ipv4.tcp_fin_timeout=30
vm.overcommit_memory = 1
net.ipv4.tcp_max_syn_backlog = 40960
net.core.netdev_max_backlog = 40960
net.core.somaxconn = 40960
生效:sysctl -p
修改 /etc/security/limits.conf:
* soft nofile 65535
* hard nofile 65535
root soft nofile 65535
root hard nofile 65535
Nginx
安装
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
sudo apt-get update
apt-get install nginx
优化
worker_processes auto;
worker_rlimit_nofile 51200;
events{
worker_connections 51200;
use epoll;
}
http{
fastcgi_intercept_errors on;
sendfile on;
server_tokens off;
types_hash_max_size 2048;
keepalive_timeout 20;
}
HHVM
安装
sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
sudo apt-get update
apt-get install hhvm
sudo /usr/share/hhvm/install_fastcgi.sh
sudo update-rc.d hhvm defaults
优化
开启PHP上传 /etc/hhvm/php.ini:
;file uploads
file_uploads = On
upload_tmp_dir = /tmp
upload_max_filesize = 16M
max_file_uploads = 20
port改socket /etc/hhvm/server.ini:
hhvm.server.file_socket=/var/run/hhvm/hhvm.sock
listen.owner= www-data
listen.group =www-data
listen.mode=0660
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.resource_limit.max_socket = 65536
/etc/nginx/hhvm.conf
location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
MySQL
安装
apt-get install mysql-server
grant all privileges on *.* to root@'% 'identified by 'newpassword';
flush privileges;
优化
show variables like 'character%';
//不同版本MySQL以下在不同文件里
[mysqld]
character-set-server = utf8
[mysql]
default-character-set=utf8
安装redis-dump
apt-get install gem2deb
gem update
gem install redis-dump
redis-dump 127.0.0.1:6379 >cache0416.json
cat cache0416.json | redis-load 127.0.0.1:6379
Created by ZhangWei @2016-05-13