typecho個人輕量級博客搭建


本文介紹使用Debian(stretch)+nginx(1.10)+typecho+sqlite3搭建輕量級博客系統。

環境:Debian(stretch)+nginx(1.10)+sqlite3

安裝Debian stretch

我的debian系統是之前安裝,一直在用。Debian系統的安裝教程可參考官網或者直接百度一下。

安裝nginx

命令行直接安裝

sudo aptitude install nginx

配置nginx

修改/etc/nginx/sites-available下的default文件,修改後的文件內容如下:

server {

        listen 80 default_server;
        listen [::]:80 default_server;


        root /var/www;


        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;


        server_name _;


        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }


        # pass PHP scripts to FastCGI server
        #
        # location ~ \.php$ {
        location ~ .*\.php(\/.*)*$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                include fastcgi_params;
        }


        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
    }

完成以上設置後,使用以下命令重啓nginx。重啓後可通過瀏覽器訪問地址 http://server_domain_or_IP 測試nginx是否安裝成功。

 sudo service nginx restart

安裝php-fpm

sudo aptitude install php7.0-fpm php7.0-cli php7.0-curl php7.0-sqlite3 php7.0-gd php7.0-xml php7.0-mcrypt php7.0-mbstring php7.0-iconv

在/var/www目錄下新建info.php文件,訪問地址 http://server_domain_or_IP/info.php 測試php是否安裝成功。info.php文件內容如下。

<?php
       phpinfo();
    ?>

安裝sqlite

使用以下命令安裝sqlite並創建數據庫文件。將數據庫文件所在文件夾權限設置爲777,否則後續安裝typecho時會出現數據庫無法連接的錯誤。

    sudo aptitude install sqlite3 php-sqlite3

    sqlite3 typecho.db

安裝typecho

進入/var/www目錄,下載typecho最新版本,將解壓後文件移動到/var/www目錄下。將/var/www目錄權限設置爲777.  

    cd /var/www
    sudo wget -c http://typecho.org/downloads/1.1-17.10.30-release.tar.gz
    sudo tar xvzf 1.1-17.10.30-release.tar.gz
    sudo mv build/* .
    chmod -R 777 /var/www

訪問地址 http://server_domain_or_IP/install.php 安裝並配置typecho。

如果php-fpm版本小於5.3.9,需要將/etc/php5/fpm/php.ini中的cgi.fix_pathinfo=0。


How To Install Linux, Nginx, MySQL, PHP (LEMP stack) in Ubuntu 16.04
利用raspberry pi搭建typecho筆記(一) nginx PHP server quick start


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章