{"id":343717,"date":"2021-02-05T19:04:35","date_gmt":"2021-02-05T11:04:35","guid":{"rendered":"http:\/\/4563.org\/?p=343717"},"modified":"2021-02-05T19:04:35","modified_gmt":"2021-02-05T11:04:35","slug":"%e6%b0%b4%e5%b9%b3%e5%a4%aa%e5%b7%ae-%e7%89%b9%e6%9d%a5%e6%b1%82%e5%8a%a9-docker-compose-lnmp-%e6%95%b0%e6%8d%ae%e5%ba%93%e8%bf%9e%e4%b8%8d%e4%b8%8a","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=343717","title":{"rendered":"\u6c34\u5e73\u592a\u5dee \u7279\u6765\u6c42\u52a9 [docker-compose LNMP \u6570\u636e\u5e93\u8fde\u4e0d\u4e0a]"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6c34\u5e73\u592a\u5dee \u7279\u6765\u6c42\u52a9 [docker-compose LNMP \u6570\u636e\u5e93\u8fde\u4e0d\u4e0a]               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jaleo <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u505a\u4e2a\u4e34\u65f6\u7ad9\u70b9 \u4ece\u672a\u5b66\u8fc7 docker \u542c\u8bf4\u5f88\u65b9\u4fbf \u4e8e\u662f\u770b\u4e86\u51e0\u7bc7\u7f51\u4e0a\u6559\u7a0b \u590d\u5236\u7c98\u8d34\u540e\u7a0d\u4f5c\u4fee\u6539 \u76ee\u524d\u60c5\u51b5\u662f\uff1adocker-compose \u80fd\u8fd0\u884c\uff0c \u5404\u5bb9\u5668\u80fd\u8fd0\u884c\uff0c\u7f51\u7ad9\u80fd\u6253\u5f00 phpinfo\uff0cphpmyadmin \u80fd\u8fde\u63a5\u4e0a mariadb \u3002\u4f46\u662f\u5b89\u88c5 wordpress \u65f6\uff0c\u5df2\u7ecf\u7528 phpmyadmin \u5efa\u4e86\u6570\u636e\u5e93\u548c\u7528\u6237\u6388\u6743\u3002\u4f46\u5b89\u88c5\u9875\u9762\u586b\u597d\u6570\u636e\u5e93\u7528\u6237\u540d\u7b49\u4fe1\u606f\u63d0\u4ea4\u540e\uff0c\u63d0\u793a\u201cThere has been a critical error on this website.\u201d \u54ea\u4f4d\u80fd\u6307\u70b9\u4e0b \u53ef\u80fd\u662f\u54ea\u91cc\u51fa\u95ee\u9898\u4e86\uff1f\u4e0b\u9762\u662f\u914d\u7f6e\u6587\u4ef6 \u4e0d\u77e5\u9053\u6709\u6ca1\u6709\u5199\u9519\u7684\u5730\u65b9\uff1f<\/p>\n<p>[\u76ee\u5f55\u7ed3\u6784] <\/p>\n<pre><code>|\u2014\u2014 html  |\u2014\u2014 index.php |\u2014\u2014 mariadb  |\u2014\u2014 conf.d    |\u2014\u2014 db  |\u2014\u2014 logs |\u2014\u2014 nginx  |\u2014\u2014 conf.d     |\u2014\u2014 domain    |fullchain.cer &amp; domain.key   |\u2014\u2014 default.conf  |\u2014\u2014 logs    |\u2014\u2014 nginx.conf |\u2014\u2014 php  |\u2014\u2014 logs  |\u2014\u2014 Dockerfile |\u2014\u2014 docker-compose.yml <\/code><\/pre>\n<p>[ Dockerfile ] <\/p>\n<pre><code>FROM php:7.4-fpm-alpine Run apt install iputils-ping  &amp;&amp; docker-php-ext-install mysqli &amp;&amp; docker-php-ext-enable mysqli &amp;&amp; docker-php-ext-install pdo pdo_mysql <\/code><\/pre>\n<p>[ docker-compose.yml ] <\/p>\n<pre><code>version: '3' networks:     lnmp-net:         driver: bridge services:     mariadb:         container_name: mariadb         image: mariadb:10.4         ports:             - 3306:3306         environment:             MYSQL_ROOT_PASSWORD: xxxxxx         volumes:             - \/lnmp\/mariadb\/db:\/var\/lib\/mysql             - \/lnmp\/mariadb\/conf.d:\/etc\/my.cnf.d             - \/lnmp\/mariadb\/logs:\/var\/log\/mariadb         restart: always         networks:             - lnmp-net     nginx:         container_name: nginx         image: nginx:latest         ports:             - 80:80             - 443:443         volumes:             - \/lnmp\/html:\/usr\/share\/nginx\/html             - \/lnmp\/nginx\/nginx.conf:\/etc\/nginx\/nginx.conf             - \/lnmp\/nginx\/conf.d:\/etc\/nginx\/conf.d             - \/lnmp\/nginx\/logs:\/var\/log\/nginx                  depends_on:             - mariadb             - php         restart: always         networks:             - lnmp-net     php:         container_name: php         build: .\/php         image: php:7.4-fpm-alpine         ports:             - 9000:9000         volumes:             - \/lnmp\/html:\/var\/www\/html             - \/lnmp\/php\/php.ini:\/usr\/local\/etc\/php\/php.ini             - \/lnmp\/php\/logs:\/usr\/local\/var\/log         restart: always         networks:             - lnmp-net     phpmyadmin:         container_name: phpmyadmin         image: phpmyadmin\/phpmyadmin         ports:             - 2000:80         restart: always         environment:             PMA_HOST: mariadb         networks:             - lnmp-net <\/code><\/pre>\n<p>[\/lnmp\/nginx\/conf.d\/default.conf ] <\/p>\n<pre><code>......     root \/usr\/share\/nginx\/html;      index index.html index.htm index.php;  error_page   500 502 503 504  \/50x.html;     location = \/50x.html {   root \/usr\/share\/nginx\/html;     }      location ~ .php$ {         fastcgi_pass   php:9000;         fastcgi_index  index.php;         fastcgi_param  SCRIPT_FILENAME  \/var\/www\/html\/$fastcgi_script_name;         include        fastcgi_params;     }     location ~ \/.ht {         deny all;     } } <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5295911\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : foMM <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             nginx \u505a\u53cd\u4ee3\u4e0d\u5982\u8bd5\u8bd5\u7528 Traefik<\/p>\n<p>https:\/\/www.bilibili.com\/video\/BV1Pg4y167o9                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5295912\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Showfom <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b89\u88c5 WordPress \u7684\u65f6\u5019\uff0chostname \u5199 mariadb \u955c\u50cf\u7684\u5185\u7f51 IP \u5730\u5740\u8bd5\u8bd5\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5295913\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jaleo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Showfom ip \u662f 172.21.0.2 \u8bd5\u4e86\u8fd8\u662f\u4e00\u6837<br \/>\u597d\u50cf\u7f51\u4e0a\u7684\u6559\u7a0b\u5927\u591a\u53ea\u6d89\u53ca\u5230\u4e0a\u9762\u7684\u7a0b\u5ea6 \u770b\u6765\u6ca1\u6709\u7cfb\u7edf\u6027\u7684\u5b66\u4e60 \u4e34\u65f6\u7a81\u51fb\u771f\u4e0d\u884c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5295914\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Yourshell <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             wordpress \u5f00 debug \u6a21\u5f0f\u770b\u770b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5295915\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shahaier <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f7f\u7528 mariadb \u8fd9\u4e2a\u540d\u5b57\u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5295916\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mxalbert1996 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             project \u5185\u90e8\u901a\u4fe1\u7684 host \u7528 service \u540d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5295917\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jaleo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mxalbert1996 <br \/>@shahaier <br \/>\u6570\u636e\u5e93\u7684 service \u540d\u662f mariadb \u5417\uff1f \u521b\u5efa\u7528\u6237\u540d\u65f6 CREATE USER &#8216;user&#8217;@&#8217;localhost&#8217; \u8fd9\u4e2a localhost \u4e5f\u8981\u7528 service \u540d\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5295918\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mxalbert1996 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @jaleo \u6211\u5efa\u8bae\u4f60\u53bb\u8bfb\u4e00\u904d\u6587\u6863\u770b\u770b @ \u540e\u9762\u8fd9\u4e2a host \u5230\u5e95\u662f\u4ec0\u4e48\u610f\u601d\u3002\u53e6\u5916\u521b\u5efa\u7528\u6237\u4e00\u822c\u7528\u73af\u5883\u53d8\u91cf\uff1a https:\/\/hub.docker.com\/_\/mariadb                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6c34\u5e73\u592a\u5dee \u7279\u6765\u6c42\u52a9 [docker&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/343717"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343717"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/343717\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343717"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}