标签: Debian

  • 搭配 SQLite 安装 WordPress

    在 Debian 10 中安装 NGINX、SQLite、PHP-FPM 及相关扩展

    $ apt update
    $ apt install -y nginx sqlite3 php7.3-fpm php7.3-curl php7.3-mbstring php7.3-mysql php-imagick php7.3-xml php7.3-zip php7.3-sqlite3 php7.3-bcmath

    配置 example.com.conf 文件

    $ rm /etc/nginx/sites-enabled/default
    $ nano /etc/nginx/sites-available/example.com.conf
    server {
            listen 80 default_server;
            listen [::]:80 default_server;
            server_name example.com www.example.com;
            root /var/www/example.com;
    
            index index.html index.php;
            location /blog {
                    try_files $uri $uri/ /blog/index.php?$args;
            }
    
            location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    fastcgi_pass unix:/run/php/php7.3-fpm.sock;
            }
    $ ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf
    $ nginx -t && nginx -s reload

    通过 Certbot 获取证书

    $ apt install python-certbot-nginx
    $ certbot --nginx -d example.com -d www.example.com
    $ crontab -e
     0 12 * * * /usr/bin/certbot renew --quiet

    下载和解压 WordPress 安装包,安装插件

    $ mkdir /var/www/example.com && cd /var/www/example.com
    $ wget https://wordpress.org/latest.zip && unzip latest.zip
    $ mv wordpress/ blog/ && cd blog/wp-content/
    $ wget https://github.com/aaemnnosttv/wp-sqlite-db/raw/master/src/db.php
    $ cd .. && mv wp-config-sample.php wp-confing.php

    可能需要设置权限

    $ cd /var/www/
    $ chown -R www-data:www-data example.com/*
    $ chmod -R 755 example.com/*

    访问 https://example.com/blog/wp-admin/install.php 进行安装

    参考资料

  • Screen 的基本用法

    Screen 是一个全屏窗口管理器,它在多个进程(通常是交互式 Shell)之间复用一个物理终端。这里简单介绍 Screen 的安装和一些基本命令的用法。

    通过 apt 安装 screen

    $ apt update
    $ apt install screen

    使用方法

    screen -S sessionname    # 将新会话的名称设置为 sessionname。
    
    screen -ls    # 显示会话标识字符串列表。 
    
    screen -d sessionname    # 分离在其他地方运行的屏幕会话。
    
    screen -r sessionname    # 恢复分离的屏幕会话。
    
    screen -R    # 恢复唯一一个分离的屏幕会话。 
    
    Ctrl + A + D    # 从该终端分离屏幕。 

    参考资料

  • Debian 9 启用 DHCPv6

    查看网络设备信息

    $ ip addr show

    编辑 /etc/network/interfaces

    $ nano /etc/network/interfaces

    启用 DHCPv6

    # 注意将 eth0 修改为你的网络设备名称
    auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp
    iface eth0 inet6 dhcp

    重启网络

    $ systemctl restart networking.service

    参考资料