步驟1:先用 Portainer compose 建立1個 stacks 如下重點說明:
只建 mysql 及 phpMyadmin(重點:network二者需成一樣這樣才可連線)!
步驟2:安裝 WordPress 如下
重點說明:
1.要先建 stacks ,compose 如下
#成功安裝 mysql phpmyadmin
version: '2'
services:
# mysql容器
xjy-mysql:
image: mysql:5.7.26
container_name: joulong-mysql
environment:
- MYSQL_USER=root
- MYSQL_ROOT_PASSWORD=root
- MYSQL_ALLOW_EMPTY_PASSWORD=no
- MYSQL_DATABASE=wordpress
ports:
- 3306:3306
command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8 --explicit_defaults_for_timestamp
networks:
- xjynet
# phpmyadmin容器
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
ports:
- "9090:80"
environment:
- MYSQL_USER=root
- MYSQL_PASSWORD=root
- MYSQL_ROOT_PASSWORD=root
- PMA_HOST=xjy-mysql
networks:
- xjynet
# portainer容器
portainer:
image: portainer/portainer:latest
container_name: joulong-portainer
restart: always
ports:
- 9095:9000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- xjynet
# 創建網路
networks:
xjynet:
driver: bridge
2.mysql與phpmyadmin如果分次安裝 network要一致如下:
3.一般 wordpress 上傳只 2M,務必修改上傳上限如下:
利用 nano 去修改 :/usr/local/etc/php/conf.d/uploads.ini 修改上傳上限(重要)
通常 nano 需安裝如何安裝如右步驟:1.apt update 2.apt upgrade 3.apt install nano
file_uploads = On
memory_limit = 500M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 600
4.修改網址是必要的建議在 mysql修改比較好如下(因有時改https後便無法連WordPress界面 ):
修改網址方法(重要)
方法1:
點選 xxx_options,會看到右手邊有兩個欄位如下:siteurl 和 home,我們需要把這兩個欄位,改回你原本的網址。
方法2:
SELECT * from wp_options where option_name = 'siteurl' and option_value = 'http://xxx.hopto.org:8333';
SELECT * from wp_options where option_name = 'home' and option_value = 'http://xxx.hopto.org:8333';
逐一修改
update wp_options set option_value = 'http://xxx.hopto.org:8116', where option_name = 'siteurl' and option_value = 'http://xxx.hopto.org:8116'
update wp_options set option_value = 'http://xxx.hopto.org:8116', where option_name = 'home' and option_value = 'http://xxx.hopto.org:8116'
**二個一起改**
update wp_options set option_value = 'http://xxx.hopto.org:8116' where option_value = 'http://localhost:8116'