使用docker-compose访问wordpress项目的首页时出现问题

时间:2019-12-26 02:08:43

标签: wordpress docker docker-compose

我开始通过docker-compose将docker(win 10家庭版中的docker工具箱)用于WordPress

昨天它运行正常,而今天我遇到了项目A的问题。

如果我尝试访问我的http://192.168.99.100:8000,它会因连接失败而重定向到http://192.168.99.100:5000。但是如果我尝试访问任何其他页面,例如http://192.168.99.100:8000/wp-admin,它都可以工作。

wordpress设置指向站点地址和wordpress地址的http://192.168.99.100:8000

这是我的docker-compose

version : '3.3'

services:
    db:
        image: mysql:5.7
        volumes:
            - db_data:/var/lib/mysql
        restart: unless-stopped
        environment:
            MYSQL_ROOT_PASSWORD: root
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress

    wordpress:
        depends_on:
            - db
        image: wordpress:5.3.2-php7.4-apache
        volumes:
            - ./app:/var/www/html
        ports:
            - "8000:80"
        restart: unless-stopped
        environment:
            WORDPRESS_DB_HOST: "db:3306"
            WORDPRESS_DB_USER: wordpress
            WORDPRESS_DB_PASSWORD: wordpress
            WORDPRESS_DB_NAME: wordpress
            WORDPRESS_DEBUG: 1

    phpmyadmin:
        depends_on:
            - db
        image: phpmyadmin/phpmyadmin
        restart: unless-stopped
        environment:
            PMA_HOST: db
            MY_SQL_ROOT_PASSWORD: root
        ports:
            - "8001:80"
volumes:
    db_data: {}

我还有另一个设置类似的项目,它们会冲突吗?项目B没有这个问题。 在项目A上工作时,我尝试停止从容器B中取出所有容器,但是问题仍然存在。

这是项目B,仅更改了wordpress和phpmyadmin的端口


version : '3.3'

services:
    db:
        image: mysql:5.7
        volumes:
            - db_data:/var/lib/mysql
        restart: unless-stopped
        environment:
            MYSQL_ROOT_PASSWORD: root
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress

    wordpress:
        depends_on:
            - db
        image: wordpress:5.3.2-php7.4-apache
        volumes:
            - ./app:/var/www/html
        ports:
            - "8080:80"
        restart: unless-stopped
        environment:
            WORDPRESS_DB_HOST: "db:3306"
            WORDPRESS_DB_USER: wordpress
            WORDPRESS_DB_PASSWORD: wordpress
            WORDPRESS_DB_NAME: wordpress
            WORDPRESS_DEBUG: 1

    phpmyadmin:
        depends_on:
            - db
        image: phpmyadmin/phpmyadmin
        restart: unless-stopped
        environment:
            PMA_HOST: db
            MY_SQL_ROOT_PASSWORD: root
        ports:
            - "8081:80"
volumes:
    db_data: {}

我认为在创建项目B后出现了问题

0 个答案:

没有答案