安装wp.md

原文链接:小回博客

docker启动

1
docker run -it --name wordpress -p 9999:80 -v /opt/wp/html:/var/www/html -d wordpress

wp-includes/function.php

1
2
3
4
5
6
7
8
9
10
11
//开启https加载js和css
// wordpress强制跳转https后,JS/CSS不加载的解决方案
add_filter('script_loader_src', 'agnostic_script_loader_src', 20,2);

function agnostic_script_loader_src($src, $handle) {
return preg_replace('/^(http|https):/', '', $src);
}
add_filter('style_loader_src', 'agnostic_style_loader_src', 20,2);
function agnostic_style_loader_src($src, $handle) {
return preg_replace('/^(http|https):/', '', $src);
}

/wp-config.php

记住一定要放到 if ( ! defined( ‘ABSPATH’ ) ) { 之前

1
2
3
4
define("FS_METHOD", "direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
$_SERVER['HTTPS'] = 'on';

修改上传配置等

1
2
3
4
docker exec nav sh -c 'echo \upload_max_filesize=50M \\n post_max_size=50M\ > /usr/local/etc/php/conf.d/uploads.ini' > /dev/null 2>&1
docker exec nav sh -c 'echo \memory_limit=256M\ > /usr/local/etc/php/conf.d/memory.ini' > /dev/null 2>&1
docker exec nav sh -c 'echo \max_execution_time=1200\ > /usr/local/etc/php/conf.d/max_execution_time.ini' > /dev/null 2>&1
docker exec nav sh -c 'echo \max_input_time=600\ > /usr/local/etc/php/conf.d/max_input_time.ini' > /dev/null 2>&1

其他

php配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
docker exec php apt update > /dev/null 2>&1
docker exec php apt install -y libmariadb-dev-compat libmariadb-dev libzip-dev libmagickwand-dev imagemagick > /dev/null 2>&1
docker exec php docker-php-ext-install mysqli pdo_mysql zip exif gd intl bcmath opcache > /dev/null 2>&1
docker exec php pecl install imagick > /dev/null 2>&1
docker exec php sh -c 'echo \extension=imagick.so\ > /usr/local/etc/php/conf.d/imagick.ini' > /dev/null 2>&1
docker exec php pecl install redis > /dev/null 2>&1
docker exec php sh -c 'echo \extension=redis.so\ > /usr/local/etc/php/conf.d/docker-php-ext-redis.ini' > /dev/null 2>&1
docker exec php sh -c 'echo \upload_max_filesize=50M \\n post_max_size=50M\ > /usr/local/etc/php/conf.d/uploads.ini' > /dev/null 2>&1
docker exec php sh -c 'echo \memory_limit=256M\ > /usr/local/etc/php/conf.d/memory.ini' > /dev/null 2>&1
docker exec php sh -c 'echo \max_execution_time=1200\ > /usr/local/etc/php/conf.d/max_execution_time.ini' > /dev/null 2>&1
docker exec php sh -c 'echo \max_input_time=600\ > /usr/local/etc/php/conf.d/max_input_time.ini' > /dev/null 2>&1

docker exec php74 apt update > /dev/null 2>&1
docker exec php74 apt install -y libmariadb-dev-compat libmariadb-dev libzip-dev libmagickwand-dev imagemagick > /dev/null 2>&1
docker exec php74 docker-php-ext-install mysqli pdo_mysql zip gd intl bcmath opcache > /dev/null 2>&1
docker exec php74 pecl install imagick > /dev/null 2>&1
docker exec php74 sh -c 'echo \extension=imagick.so\ > /usr/local/etc/php/conf.d/imagick.ini' > /dev/null 2>&1
docker exec php74 pecl install redis > /dev/null 2>&1
docker exec php74 sh -c 'echo \extension=redis.so\ > /usr/local/etc/php/conf.d/docker-php-ext-redis.ini' > /dev/null 2>&1
docker exec php74 sh -c 'echo \upload_max_filesize=50M \\n post_max_size=50M\ > /usr/local/etc/php/conf.d/uploads.ini' > /dev/null 2>&1
docker exec php74 sh -c 'echo \memory_limit=256M\ > /usr/local/etc/php/conf.d/memory.ini' > /dev/null 2>&1
docker exec php74 sh -c 'echo \max_execution_time=1200\ > /usr/local/etc/php/conf.d/max_execution_time.ini' > /dev/null 2>&1
docker exec php74 sh -c 'echo \max_input_time=600\ > /usr/local/etc/php/conf.d/max_input_time.ini' > /dev/null 2>&1

http://example.com/4.html
作者
John Doe
发布于
2025年10月31日
许可协议