2017-12-28 12 views
0

複数のWordPressをホストにデプロイしようとしています。私は良いサブドメインへの接続を配布するためにnginxを使用します。複数のワードプレスを1つのホストにインストールする

WordPressとMySQLをサービスとして正常にインストールした最初のコンテナを導入しました。このスクリプトでは:私は(3009に8004と3308に8003からのポートを変更した後に)同じスクリプトで二番目を追加するとき

version: '2' 
 

 
services: 
 
    db3: 
 
    image: mysql:5.7 
 
    volumes: 
 
     - db_wp_lmt_data:/var/lib/mysql 
 
    restart: always 
 
    ports: 
 
     - 3308:3306 
 
     - 3308 
 
    environment: 
 
     MYSQL_ROOT_PASSWORD: FFFF 
 
     MYSQL_DATABASE: DDDD 
 
     MYSQL_USER: XXX 
 
     MYSQL_PASSWORD: YYYY 
 
    wordpress: 
 
    depends_on: 
 
     - db3 
 
    image: wordpress:latest 
 
    ports: 
 
     - "8003:80" 
 
    restart: always 
 
    environment: 
 
     WORDPRESS_DB_HOST: db3:3306 
 
     WORDPRESS_DB_USER: XXX 
 
     WORDPRESS_DB_PASSWORD: YYYY 
 
     VIRTUAL_HOST: ZZZZZ 
 
    volumes: 
 
     - wp_lmt_data:/var/www/html 
 
volumes: 
 
    db_wp_lmt_data: 
 
    wp_lmt_data: 
 
networks: 
 
    default: 
 
    external: 
 
     name: nginxproxy_default

しかし、私はいくつかのトラブルを得ました。 mysqlサーバは外部からアクセス可能ですが、wordpressは動作しません。私がホスト "curl -k localhost:8004"から行うと、何も返されませんが、他のwordpressはメインページの内容を返します。

私はそれがなぜ機能していないのか理解しようとし、解決しました。しかし、今私はそれを解決する方法を知りません。さらに、私はコンテナを開始し

モードとすべてがうまくように見えます添付:

db3_1  | 2017-12-27T23:50:45.558909Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
 
db3_1  | 2017-12-27T23:50:45.597390Z 0 [Note] mysqld (mysqld 5.7.20) starting as process 1 ... 
 
db3_1  | 2017-12-27T23:50:45.612731Z 0 [Note] InnoDB: PUNCH HOLE support available 
 
db3_1  | 2017-12-27T23:50:45.612804Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
 
db3_1  | 2017-12-27T23:50:45.612812Z 0 [Note] InnoDB: Uses event mutexes 
 
db3_1  | 2017-12-27T23:50:45.612818Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 
 
db3_1  | 2017-12-27T23:50:45.612824Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 
 
db3_1  | 2017-12-27T23:50:45.612830Z 0 [Note] InnoDB: Using Linux native AIO 
 
db3_1  | 2017-12-27T23:50:45.632121Z 0 [Note] InnoDB: Number of pools: 1 
 
db3_1  | 2017-12-27T23:50:45.632384Z 0 [Note] InnoDB: Using CPU crc32 instructions 
 
db3_1  | 2017-12-27T23:50:45.657365Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 
 
db3_1  | 2017-12-27T23:50:45.722114Z 0 [Note] InnoDB: Completed initialization of buffer pool 
 
db3_1  | 2017-12-27T23:50:45.735602Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 
 
db3_1  | 2017-12-27T23:50:45.759510Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 
 
db3_1  | 2017-12-27T23:50:45.798036Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 
 
db3_1  | 2017-12-27T23:50:45.798748Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 
 
db3_1  | 2017-12-27T23:50:45.873142Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 
 
db3_1  | 2017-12-27T23:50:45.874746Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 
 
db3_1  | 2017-12-27T23:50:45.874819Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 
 
db3_1  | 2017-12-27T23:50:45.876036Z 0 [Note] InnoDB: Waiting for purge to start 
 
db3_1  | 2017-12-27T23:50:45.926379Z 0 [Note] InnoDB: 5.7.20 started; log sequence number 12156537 
 
db3_1  | 2017-12-27T23:50:45.928422Z 0 [Note] Plugin 'FEDERATED' is disabled. 
 
db3_1  | 2017-12-27T23:50:45.932793Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 
 
db3_1  | 2017-12-27T23:50:45.968083Z 0 [Note] InnoDB: Buffer pool(s) load completed at 171227 23:50:45 
 
db3_1  | 2017-12-27T23:50:45.969521Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 
 
db3_1  | 2017-12-27T23:50:45.973412Z 0 [Warning] CA certificate ca.pem is self signed. 
 
db3_1  | 2017-12-27T23:50:45.976434Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 
 
db3_1  | 2017-12-27T23:50:45.981110Z 0 [Note] IPv6 is available. 
 
db3_1  | 2017-12-27T23:50:45.981787Z 0 [Note] - '::' resolves to '::'; 
 
db3_1  | 2017-12-27T23:50:45.982192Z 0 [Note] Server socket created on IP: '::'. 
 
db3_1  | 2017-12-27T23:50:45.989810Z 0 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:45.990490Z 0 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:45.990563Z 0 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:45.990660Z 0 [Warning] 'db' entry 'performance_schema [email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:45.990738Z 0 [Warning] 'db' entry 'sys [email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:45.990805Z 0 [Warning] 'proxies_priv' entry '@ [email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:45.996112Z 0 [Warning] 'tables_priv' entry 'user [email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:45.996739Z 0 [Warning] 'tables_priv' entry 'sys_config [email protected]' ignored in --skip-name-resolve mode. 
 
db3_1  | 2017-12-27T23:50:46.021269Z 0 [Note] Event Scheduler: Loaded 0 events 
 
db3_1  | 2017-12-27T23:50:46.022382Z 0 [Note] mysqld: ready for connections. 
 
db3_1  | Version: '5.7.20' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) 
 
db3_1  | 2017-12-27T23:50:46.022476Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check. 
 
db3_1  | 2017-12-27T23:50:46.022543Z 0 [Note] Beginning of list of non-natively partitioned tables 
 
db3_1  | 2017-12-27T23:50:46.069871Z 0 [Note] End of list of non-natively partitioned tables 
 
wordpress_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.6. Set the 'ServerName' directive globally to suppress this message 
 
wordpress_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.6. Set the 'ServerName' directive globally to suppress this message 
 
wordpress_1 | [Wed Dec 27 23:50:46.370813 2017] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.0 configured -- resuming normal operations 
 
wordpress_1 | [Wed Dec 27 23:50:46.374367 2017] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

ご清聴ありがとうございました。

答えて

0

私は最終的に私が望むことをする方法を見つける。私は私のdocker-compose.ymlを削除し、最初から始めました。

私の代わりにこのスクリプトを使用:

version: '2' 
 

 
services: 
 
    wordpress: 
 
     image: wordpress 
 
     links: 
 
     - mariadb:mysql 
 
     environment: 
 
     - WORDPRESS_DB_PASSWORD=XXX 
 
     - VIRTUAL_HOST= YYY 
 
     ports: 
 
     - "10001:80" 
 
     - 10001 
 
     expose: 
 
     - 10001 
 
     volumes: 
 
     - mywordpressvolume:/var/www/html 
 

 
    mariadb: 
 
     image: mariadb 
 
     environment: 
 
     - MYSQL_ROOT_PASSWORD=XX 
 
     - MYSQL_DATABASE=wordpress 
 
     volumes: 
 
     - mydbvolume:/var/lib/mysql 
 

 
volumes: 
 
    mywordpressvolume: 
 
    mydbvolume: 
 
    
 
networks: 
 
    default: 
 
    external: 
 
     name: nginxproxy_default

をこれは私に働いてワードプレスを与えました。私はまだワードプレスがこのような振る舞いをしていたのかどうか混乱しています。たぶん、データベースが理由でWordPressでアクセスできない場合があり、サービス名とのリンクを使用するのがよい方法だろうかと思います。次に、私はこのコマンドを使用しました。

ドッカーexec mycontainername env | grep "VIRTU"

私のコンテナで使用されるすべてのVIRTUAL_HOST変数をチェックします。そして最後に、それは終わった。

関連する問題