wordpress部署

准备环境


1.宿主机mysql创建用户wordpress,创建数据库wordpress

2.提前准备好docker环境

开始部署

1.安装并运行docker镜像,将wordpress配置文件映射到主机方便修改

docker container run \
-d \
-p 8080:80 \
--rm \
--name wordpress \
-e WORDPRESS_DB_HOST=10.4.4.13 \
-e WORDPRESS_DB_USER=wordpress \
-e WORDPRESS_DB_PASSWORD=123456 \
-e WORDPRESS_DB_NAME=wordpress \
--volume "$PWD/wordpress":/var/www/html \
wordpress

2.修改wordpress根目录下wp-config.php文件

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress') );
/** MySQL database username */
define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'root') );
/** MySQL database password */
define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', '123456') );

3.浏览器访问服务器8080端口配置初始化信息

补充说明

1.修改最大上传文件大小

  • 在根目录下修改.htaccess文件,
vi .htccess
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value memory_limit 128M
php_value max_execution_time 300
</IfModule>

# END WordPress

2.给服务器绑定域名和证书后无法访问

  • 问题说明:
    在nginx配置ssl证书后,访问http可以连接,https返回(failed) net::ERR_SSL_PROTOCOL_ERROR,证书配置有效期都正常
  • 问题分析:
    在curl -v wp.010611.xyz 的时候发现,证书验证正常,但是服务器却重定向到https://wp.010611.xyz:8080
  • 问题原因:
    wordpress配置中有home和siteurl,在MySQL中修改wordpress数据库wp_options表中siteurl和home的值为https://wp.010611.xyz。

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
下一篇