##1 安装nginx,mysql,php环境
sudo apt-get install nginx php5-fpm php5-cgi php5-cli php5-curl php5-gd php5-mcrypt php5-mysql php5-memcache php5-xmlrpc mysql-server mysql-client
##2配置nginx
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.backup
sudo rm -rf /etc/nginx/sites-available/default
sudo nano /etc/nginx/sites-available/default
server { listen 80 default_server; root /var/www; index index.html index.htm index.php;
gzip on; gzip_min_length 1k; gzip_buffers 16 64k; gzip_http_version 1.1; gzip_comp_level 6; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; server_name hackti.me;
location / {
# if (-f $request_filename/index.html){
# rewrite (.*) $1/index.html break;
# }
# if (-f $request_filename/index.php){
# rewrite (.*) $1/index.php;
# }
# if (!-f $request_filename){
# rewrite (.*) /index.php;
# }
#或者:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
}
location ~ .*\.php(\/.*)*$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
sudo service nginx restart
登陆typecho后台启用地址重写功能~
##3配置mysql
mysql_secure_installation
输入密码,第一个n,其余y
mysql -u root -p
输入密码
create database typecho;
exit;
##4安装typecho
wget https://github.com/typecho/typecho/releases/download/v1.1-15.5.12-beta/typecho.tar.gz
tar -zxvf typecho.tar.gz
rsync -avP ~/build/ /var/www/