搭配 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 进行安装

参考资料

评论

《“搭配 SQLite 安装 WordPress”》 有 1 条评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注