编译PHP8.31 并安装 wordpress

编译PHP(版本8.13)

编译选项:
‘./configure’ ‘–enable-fpm’ ‘–with-mysqli’ ‘–with-curl’ ‘–enable-exif’ ‘–with-mhash’ ‘–enable-mbstring’ ‘–with-openssl’ ‘–with-zip’ ‘–enable-gd’ ‘–with-zlib’
(根据服务器提示安装缺少的一些库的头文件(dev)

make
sudo make install

编译完成后,PHP的配置修改参考:
https://www.php.net/manual/zh/install.unix.nginx.php

Nginx的配置稍有不同,修改/etc/nginx/sites-available/default 文件。

建立mysql数据库

CREATE DATABASE 'blog' DEFAULT CHARACTER SET utf8;
create user 'username'@'%' indentified by 'password';
grant all on blog.* to 'username'@'%';

安装wordpress

  • 下载最新版wordpress
  • 解压到网站目录,如/var/www/html
  • 将html目录的权限赋给www-data(nginx用来处理网络请求的专门账号)(这样wordpress就有权限能自己编辑一些文件)(是否有安全问题?)

chown -R www-data html/

enable SSL

参考:
https://certbot.eff.org/instructions?ws=nginx&os=ubuntufocal

发表评论