树洞外链的搭建(备忘)
一. 树洞外链是什么?
树洞外链是一个开源的图床文件。自己搭建一个图床,可以在日常的Markdown写作中插入图片,提高文章的可读性。
树洞外链项目的地址: https:// github.com/HFO4/shudong -share
二. 树洞外链的搭建步骤
先安装树洞外链的运行依赖三个工具:
- Nginx
- PHP
- Mysql
Nginx的安装: apt-get install nginx
PHP的安装:
step1.在/etc/apt/sources.list新增源
deb http://mirrors.digitalocean.com/debian jessie main contrib non-free
deb-src http://mirrors.digitalocean.com/debian jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
# jessie-updates, previously known as 'volatile'
deb http://mirrors.digitalocean.com/debian jessie-updates main contrib non-free
deb-src http://mirrors.digitalocean.com/debian jessie-updates main contrib non-free
step2. apt-get update
step3. apt-get install php5-fpm php5-mysql
Mysql的安装: apt-get install mysql-server
三个工具安装好后,可以下载shudong的项目了:
wget https:// github.com/HFO4/shudong -share/archive/2.4.7.tar.gz
- 将其解压:tar -xzvf 2.4.7.tar.gz
- 加压后的目录放到:/home/www-data/shudong
root@debian:~# ls /home/www-data/shudong/
admin config.php content data favicon.ico f.php includes index.php LICENSE README.md s.php views
3. 接着改变这个目录的属主:chown www-data:www-data /home/www-data/shudong -R
4. 修改nginx的配置文件/etc/nginx/sites-available/default,
server {
listen 80 default_server;
root /home/www-data/shudong;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
index = index.html index.php
try_files $uri $uri/ =404;
location ~ \.php$ {