用 frankenphp+mysql 快速搭建一个高性能的wordpress网站!

 







FrankenPHP 是构建在Caddy Web 服务器之上的现代 PHP 应用程序服务器。




docker安装

curl -fsSL https://get.docker.com | sh && ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin


创建目录结构

mkdir -p /home/web/{caddy,html,,mysql}

touch /home/web/caddy/Caddyfile



下载源码

cd /home/web/html/ && mkdir web1 && cd web1

wget -O latest.zip https://cn.wordpress.org/latest-zh_CN.zip

unzip latest.zip

rm latest.zip


echo "define('FS_METHOD', 'direct'); define('WP_REDIS_HOST', 'redis'); define('WP_REDIS_PORT', '6379');" >> /home/web/html/web1/wordpress/wp-config-sample.php



配置Caddyfile

nano /home/web/caddy/Caddyfile


{

        frankenphp

        order mercure after encode

        order vulcain after reverse_proxy

        order php_server before file_server

        order php before file_server

}



kjlion.com {

        root * public/web1/wordpress

        encode zstd gzip

        php_server

}



启动环境

wget -O /home/web/docker-compose.yml https://raw.githubusercontent.com/kejilion/docker/main/docker-compose-frankenphp.yml

nano /home/web/docker-compose.yml

cd /home/web && docker-compose up -d


安装PHP扩展

docker exec -it web install-php-extensions mysqli gd intl zip opcache

docker exec -it web install-php-extensions exif imagick redis

docker exec web sh -c 'echo "upload_max_filesize=50M \n post_max_size=50M" > /usr/local/etc/php/conf.d/uploads.ini'

docker exec web sh -c 'echo "memory_limit=256M" > /usr/local/etc/php/conf.d/memory.ini'

docker exec web sh -c 'echo "max_execution_time=1200" > /usr/local/etc/php/conf.d/max_execution_time.ini'

docker exec web sh -c 'echo "max_input_time=600" > /usr/local/etc/php/conf.d/max_input_time.ini'



创建数据库

docker exec -it mysql mysql -u root -p

CREATE DATABASE web1;

GRANT ALL PRIVILEGES ON web1.* TO 'kejilion'@'%';


重启环境

cd /home/web && docker-compose restart













 







评论

此博客中的热门博文

2023国外的接码平台分享

科技lion官方一键脚本上线!VPS监控测试建站维护于一身的全能工具箱

最简单的白嫖office 365 E5 账号教程 可开25个子号 每个号OneDrive5t空间