0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WordPressをdockerで立てる

0
Posted at

wordpress を docker-compose で起こしてみました
ちなみに、mysqlのバージョンは9.7です

DB側の設定

wordpress は mysqlが標準とのことで、mysqlを使いました。

CREATE DATABASE wpdb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER wpuser IDENTIFIED WITH caching_sha2_password  BY 'xxxxxx';
grant all privileges on wpdb.* to wpuser;

docker-compose.yml

61010 ポートで上げます

services:
  wordpress:
    image: wordpress:latest
    container_name: wordpress
    restart: always
    ports:
      - "61010:80"
    environment:
      WORDPRESS_DB_HOST: ${WORDPRESS_DB_HOST}
      WORDPRESS_DB_USER: ${WORDPRESS_DB_USER}
      WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD}
      WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME}
    volumes:
      - ./docker/wp-content:/var/lib/wordpress/wp-content

wordpress:latest には、apache+phpも入っているらしいです。

参考

vi .env
WORDPRESS_DB_HOST=192.168.x.x:3306
WORDPRESS_DB_USER=wpuser
WORDPRESS_DB_PASSWORD=xxxxxx
WORDPRESS_DB_NAME=wpdb

完成

image.png

感想など

さくらインターネットのレンタルサーバを借りて、ホームページを作ろうと思ったのですが、
そもそもWordPress全然わかってない。。。
じゃあ、まず、手元につくるか!ということでやってみました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?