用 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













 







评论

  1. 匿名4/16/2024

    用的是一键脚本安装的Wordpress网站
    你的下面这个代码要怎么修改才可以使用?谢谢。想要个性上传文件的限制到1024MB。
安装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=1024M \n post_max_size=1024M" > /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'

    原博客地址:https://kejilion.blogspot.com/2024/01/frankenphp-caddy-web-php-docker-curl.html

    回复删除

发表评论

此博客中的热门博文

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

CloudCone付费VPS分享 挺便宜的

新机到手我必做的10件事?让VPS飞速运行更安全!