树莓派2 折腾记录
- - 操作系统 - ITeye博客淘宝买来的 树莓派2代 B型. 这玩意还分国产和UK产,价格差距在10-20左右 不过不超过200. 另外就是要单独配个 5V2A 的电源,可选外壳和散热片,必备的是 TF 卡,可以用8G,我直接用的 32G TF 卡. 这玩意安装比较麻烦,简单的说第一次进系统你需要显示器,他只有HDMI接口,可以考虑用 HDMI转VGA连显示器,要么就直接HDMI连液晶电视(我就用的电视装的).
sudo vi /etc/X11/default-display-manager
sudo fdisk /dev/mmcblk0
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid-updates main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid-security main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid-backports main restricted universe multiverse
sudo apt-get update sudo apt-get upgrade
sudo apt-get install openssh-server openssh-sftp-server #修改配置文件 /etc/ssh/sshd_config sudo vi /etc/ssh/sshd_config #增加 USEDNS no 这样可以加速ssh开始连接速度 #重启服务 sudo service ssh restart sudo /etc/init.d/ssh restart
sudo apt-get install pptpd
sudo service pptpd restart sudo service pppd-dns restart
server {
#对外端口为80
listen 80;
server_name localhost;
#=====更改文件编码为UTF-8
#charset utf-8;
#access_log logs/host.access.log main;
location / {
#使用www目录作为项目目录
root /www;
#禁止列出目录
autoindex off;
#Nginx目录自动加斜线:
if (-d $request_filename){
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
}
#禁止记录文件日志
location ~ .*\.(js|jpg|JPG|jpeg|JPEG|css|bmp|gif|GIF|png|PNG|ico|ICO)$ {
access_log off;
}
index index.html index.htm index.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# PHP转发
location ~ \.php$ {
#这地方根据系统配置是用端口还是用sock方式
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
#这个位置也要修改自己的目录位置 www
fastcgi_param SCRIPT_FILENAME /www/$fastcgi_script_name;
include fastcgi_params;
}
}