{"id":5,"date":"2021-09-28T00:00:22","date_gmt":"2021-09-27T15:00:22","guid":{"rendered":"http:\/\/fr.tsbio.info\/labo\/suzuki\/?p=5"},"modified":"2021-10-14T21:49:15","modified_gmt":"2021-10-14T12:49:15","slug":"wordpress","status":"publish","type":"post","link":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/archives\/5","title":{"rendered":"Docker\u3092\u4f7f\u3063\u3066WordPress\u306e\u52d5\u304f\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u3092\u7acb\u3061\u4e0a\u3052\u308b"},"content":{"rendered":"<p>WordPress\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001\u65e2\u5b58\u306eCentOS7\u3067\u52d5\u304b\u305d\u3046\u3068\u3057\u305f\u3068\u3053\u308d\u3001WordPress\u306e\u8981\u4ef6(PHP7\u3084MySQL)\u3092\u6574\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u305d\u3053\u3067docker\u3067\u4eee\u60f3\u74b0\u5883\u3092\u7528\u610f\u3057\u3066\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h3>docker\u30a4\u30e1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<pre class=\"console\"># yum install docker\n# docker pull docker.io\/wordpress\n# docker pull docker.io\/mysql:5.7  # \u6700\u65b0\u7248(8)\u3067\u306f\u8a8d\u8a3c\u304c\u8d85\u3048\u3089\u308c\u306a\u304b\u3063\u305f\n<\/pre>\n<h3>\u30b3\u30f3\u30c6\u30ca\u306e\u4f5c\u6210<\/h3>\n<h4>MySQL\u3092\u8d77\u52d5<\/h4>\n<p>\u30b3\u30f3\u30c6\u30ca\u306e\u540d\u524d\u306fmy-db\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u306fxxx\u3068\u3057\u307e\u3057\u305f\u3002 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u4f7f\u7528\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u30db\u30b9\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea(\/anywhere\/mysql)\u306b\u3057\u307e\u3057\u305f\u3002 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30a4\u30e1\u30fc\u30b8\u306e\u4e2d\u306b\u3044\u308c\u306a\u3044\u3053\u3068\u3067\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u307e\u308b\u3054\u3068\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304c\u3068\u308a\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"console\"># docker run -d --name my-db --env=MYSQL_ROOT_PASSWORD=xxx \\\n    --volume \/anywhere\/mysql:\/var\/lib\/mysql \\\n    --restart unless-stopped \\\n    docker.io\/mysql:5.7\n<\/pre>\n<h4>WordPress\u3092\u8d77\u52d5<\/h4>\n<p>WordPress\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3084\u30c6\u30fc\u30de\u3092\u3044\u308c\u308b\u3068\u304d\u306b\u3001\u76f4\u63a5\u30d5\u30a1\u30a4\u30eb\u3092\u64cd\u4f5c\u3067\u304d\u305f\u307b\u3046\u304c\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001docker\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u64cd\u4f5c\u3059\u308b\u306e\u306f\u9762\u5012\u3067\u3001\u30b3\u30f3\u30c6\u30ca\u5185\u3067\u306fvi\u3082\u4f7f\u3048\u307e\u305b\u3093\u3002\u305d\u3053\u3067WordPress\u306e\u30d5\u30a1\u30a4\u30eb\u3092docker\u306e\u5916\u306b\u51fa\u3059\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4e00\u65e6docker\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u3001WordPress\u306e\u30d5\u30a1\u30a4\u30eb\u3092docker\u306e\u5916\u3078\u30b3\u30d4\u30fc\u3057\u3066\u3001\u305d\u308c\u3092\u30de\u30a6\u30f3\u30c8\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u30b3\u30f3\u30c6\u30ca\u306e\u540d\u524d\u306fmy-wp\u3068\u3057\u3066\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002DocumentRoot\u304c\/var\/www\/html\u3067\u3001\u3053\u308c\u3082\u30db\u30b9\u30c8\u5074\u304b\u3089\u64cd\u4f5c\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002\u30db\u30b9\u30c8\u306e8000\u30dd\u30fc\u30c8\u3092WordPress\u306e\u30a4\u30e1\u30fc\u30b8\u306e80\u756a\u30dd\u30fc\u30c8\u306b\u3064\u306a\u3044\u3067WordPress\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"console\"># docker run -d --name my-wp wordpress # \u4e00\u65e6\u3064\u304f\u308b\n# docker cp my-wp:\/var\/www\/html \/anywhere\/    # docker\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u5916\u3078\u30b3\u30d4\u30fc\n# docker rm my-wp    # \u524a\u9664\u3002\u524d\u3082\u3063\u3066stop\u304c\u5fc5\u8981\u3060\u3063\u305f\u304b\u3082\u3002\n# docker run -d --name my-wp \\\n    --publish 8000:80 \\\n    --volume \/anywhere\/html:\/var\/www\/html \\\n    --link my-db:mysql \\\n    --restart unless-stopped \\\n    wordpress\n<\/pre>\n<h3>WordPress\u306e\u8a2d\u5b9a<\/h3>\n<p>http:\/\/host.ip.address:8000\/ \u306b\u9069\u5f53\u306a\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002\u5fc5\u8981\u306a\u9805\u76ee\u306f\u7ba1\u7406\u8005\u540d\u3001\u305d\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3001\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306e\u540d\u524d\u3050\u3089\u3044\u3067\u3059\u3002<\/p>\n<h3>WordPress\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7<\/h3>\n<p>docker\u30a4\u30e1\u30fc\u30b8\u3092\u66f4\u65b0\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"console\"># docker pull docker.io\/wordpress\n# docker stop my-wp\n# docker rename my-wp my-wp.old # \u73fe\u5728\u306e\u30b3\u30f3\u30c6\u30ca\u306e\u540d\u524d\u3092\u5909\u66f4\u3059\u308b\u3002\n# mv \/anywhere\/html \/anywhere\/html.old\n# docker run -d -name my-wp wordpress    # \u65b0\u3057\u3044\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\n# docker cp my-wp:\/var\/www\/html \/anywhere\/    # docker\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u5916\u3078\u30b3\u30d4\u30fc\n# docker rm my-wp    # \u524a\u9664\n# cp -r \/anywhere\/html.old\/wp-content\/{plugin,theme,uploads} \/anywhere\/html\n# cp -r \/anywhere\/html.old\/wp-config.php \/anywhere\/html    # .htaccess\u3082\u540c\u69d8\u306b\u30b3\u30d4\u30fc\n# docker run -d --name my-wp wordpress    # \u305d\u306e\u4ed6\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u4e0a\u3068\u540c\u3058\u306a\u306e\u3067\u7701\u7565\n<\/pre>\n<p>\u65b0\u3057\u3044\u30b3\u30f3\u30c6\u30ca\u306b\u63a5\u7d9a\u3059\u308b\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u66f4\u65b0\u3092\u884c\u3044\u307e\u3059\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u305f\u3076\u3093\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u306f\u3053\u306e\u3050\u3089\u3044\u3060\u3063\u305f\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u8db3\u308a\u306a\u3044\u5834\u5408\u306f\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u898b\u3066\u9069\u5b9c\u4fee\u6b63\u3057\u307e\u3059\u3002<br \/>\n\/anywhere\/html \u306e\u30a2\u30af\u30bb\u30b9\u6a29\u304c\u305f\u3073\u305f\u3073\u5f15\u3063\u639b\u304b\u308a\u307e\u3059\u3002chown -R :33 \/anywhere\/html; chmod -R g+w \/anywhere\/html \u3068\u3057\u3066\u304a\u304f\u3068\u3044\u3044\u3067\u3059\u3002<\/p>\n<h3>\u30b5\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a<\/h3>\n<h4>php.ini<\/h4>\n<p>php.ini\u306f\/usr\/local\/etc\/php\/\u306b\u304a\u304d\u307e\u3059\u3002\u6700\u521d\u306f\u7121\u3044\u306e\u3067php.ini-production\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code\"># docker cp my-wp:\/usr\/local\/etc\/php\/php.ini-production .\/php.ini\n# vim php.ini\n# upload_max_filesize = 2M \u3092 8M\u306b\u4fee\u6b63\u3002post_max_size\u306f\u3082\u3068\u3082\u30688M\n# docker cp php\/php.ini my-wp:\/usr\/local\/etc\/php\/\n# docker restart my-wp\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001\u65e2\u5b58\u306eCentOS7\u3067\u52d5\u304b\u305d\u3046\u3068\u3057\u305f\u3068\u3053\u308d\u3001WordPress\u306e\u8981\u4ef6(PHP7\u3084MySQL)\u3092\u6574\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u305d\u3053\u3067docker\u3067\u4eee\u60f3\u74b0\u5883\u3092\u7528\u610f\u3057\u3066\u3084\u3063\u3066\u307f\u307e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[19,8],"_links":{"self":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts\/5"}],"collection":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":33,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":658,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts\/5\/revisions\/658"}],"wp:attachment":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}