无法在Docker Wordpress中访问Apache ServerName错误的网站

问题描述 投票:2回答:1

我一直遵循此tutorial来部署多个应用程序,而不是我以前在VPS中使用Docker的唯一应用程序。

我修改了我的应用程序docker-compose.yml文件,添加了本教程中要求的变量,例如VIRTUAL_HOST等。

每个步骤似乎都很好,但是当我尝试通过我的域访问我的网站时,我做不到。我收到503错误或什至没有响应。

事实是,如果我进入wordpress容器并检查日志,则会发现:

AH00558:apache2:使用172.18.0.6无法可靠地确定服务器的标准域名。全局设置“ ServerName”指令以禁止显示此消息

之后还有更多消息,但我不知道它们是否意味着问题已解决:

[[Sat May 04 11:34:23.381791 2019] [mpm_prefork:notice] [pid 1] AH00163:已配置Apache / 2.4.25(Debian)PHP / 7.2.17-恢复正常操作

[[[Sat May 04 11:34:23.382141 2019] [core:notice] [pid 1] AH00094:命令行:'apache2 -D FOREGROUND'

我会说这可以在Wordpress dashboard中进行配置,但是由于我无法访问它,因此无法修复它。另外,如果这是不允许我访问任何网站的问题,我还必须说我不确定

关于如何解决的任何想法?

数据

Wordpress docker-compose.yml(另一个与之类似,但是具有其他文件夹,另一个域,等等):

version: '3.3'

services:
  db_mysql_btcsources:
    image: mysql:5.7
    volumes:
      - /root/wp_btcsources/database:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: xxx
      MYSQL_DATABASE: xxx
      MYSQL_USER: xxx
      MYSQL_PASSWORD: xxx
    container_name: mysql_btcsources

  wp_blog_btcsources:
    depends_on:
      - db_mysql_btcsources
    image: wordpress:latest
    expose:
      - 80
      - 443
    restart: always
    environment:
      WORDPRESS_DB_HOST: db_mysql_btcsources:3306
      WORDPRESS_DB_USER: xxx
      WORDPRESS_DB_PASSWORD: xxx
      WORDPRESS_DB_NAME: xxx
      VIRTUAL_HOST: www.btcsources.es
      LETSENCRYPT_HOST: www.btcsources.es
      LETSENCRYPT_EMAIL: [email protected]
    volumes:
    - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
    container_name: wp_btcsources

volumes:
  uploads.ini:

networks:
    default:
        external:
            name: nginx-proxy

网络nginx-proxy元素:

    "Containers": {
        "04335b2e1208a14bf5999eb10918017fb0e80fcf27b88b0eb427db621b01127e": {
            "Name": "nginx-proxy-le",
            "EndpointID": "ebf45a130674ec8174ea573706b57bc2fdde76c68365accc1e873cf3315ec8f9",
            "MacAddress": "02:42:ac:12:00:04",
            "IPv4Address": "172.18.0.4/16",
            "IPv6Address": ""
        },
        "0b2f66f7d68fbc3c45994bdfcbca241419e2472e44de3b67eb2bc0e62513d404": {
            "Name": "wp_rociocorbart",
            "EndpointID": "7d24c5eda09e7388831bb6bfe39fd97d779e151fd54f97d777e10a6fea622484",
            "MacAddress": "02:42:ac:12:00:08",
            "IPv4Address": "172.18.0.8/16",
            "IPv6Address": ""
        },
        "251e8f9929b8756f9a1aac29a640f80a74dd07a99f3ae25ff1314f3d7617c642": {
            "Name": "mysql_btcsources",
            "EndpointID": "b1f44a89dac9199ccfb59d8299ad97dda4a199d310016c2c97131260df76cfc9",
            "MacAddress": "02:42:ac:12:00:05",
            "IPv4Address": "172.18.0.5/16",
            "IPv6Address": ""
        },
        "43bf6754b052eb5ff42b1dbb4537f407a0740673d8eeec438f06d7295deb7578": {
            "Name": "mysql_rociocorbart",
            "EndpointID": "c6a99711e81f8191376a26b0108179bc3278d1e962e6f6531ef60469e551dad9",
            "MacAddress": "02:42:ac:12:00:07",
            "IPv4Address": "172.18.0.7/16",
            "IPv6Address": ""
        },
        "61153ca057c5940584e2ccf039883a730ecc4ff7169b44195eac585e73fb8f04": {
            "Name": "nginx-proxy-gen",
            "EndpointID": "21846fb74284682e0d6a9533f3742d1b91ced2958c085f6d456e644d8261b1ca",
            "MacAddress": "02:42:ac:12:00:03",
            "IPv4Address": "172.18.0.3/16",
            "IPv6Address": ""
        },
        "c2364adf3405b1119773f26f6a02a65d834a521510d3a22ff54e88a53cfd293e": {
            "Name": "wp_btcsources",
            "EndpointID": "636bba853188b76ed46fae2aee88c89fd17d219d675d71c5dfd14d46a60efb22",
            "MacAddress": "02:42:ac:12:00:06",
            "IPv4Address": "172.18.0.6/16",
            "IPv6Address": ""
        },
        "eb16ca01f3da71359c6fa1d2fd6d591ccca773e3c4f72d1a9b1e5da5245ad306": {
            "Name": "nginx-proxy",
            "EndpointID": "2bf727ac0a7689c5b2ffdda2a06275f05f6da81bc5d1dd12891126902850507e",
            "MacAddress": "02:42:ac:12:00:02",
            "IPv4Address": "172.18.0.2/16",
            "IPv6Address": ""
        }
config file是this one

Nginx

日志

www.btcsources.es my_personal_ip_censored - - [04/May/2019:12:56:51 +0000] "GET / HTTP/1.1" 503 213 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0" www.btcsources.es my_personal_ip_censored - - [04/May/2019:12:56:51 +0000] "GET /favicon.ico HTTP/1.1" 503 213 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0" www.btcsources.es my_personal_ip_censored - - [04/May/2019:13:03:48 +0000] "GET / HTTP/1.1" 503 213 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0" www.btcsources.es my_personal_ip_censored - - [04/May/2019:13:03:48 +0000] "GET /favicon.ico HTTP/1.1" 503 213 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
Nginxdocker-compose.ymlmodified for 

debug模式

command: [nginx-debug, '-g', 'daemon off;']
Nginx 

执行后的日志是相同的]

,因此这里是compose up输出(请注意,这是两个不是代理的nginx容器):
附加到nginx代理,nginx代理,nginx代理nginx代理| 2019/05/04 15:16:24的内容/etc/nginx/conf.d/default.conf不变。跳过通知”

nginx-proxy-gen | 2019/05/04 15:16:24观看docker事件

nginx-proxy-gen | 2019/05/04 15:16:25的内容/etc/nginx/conf.d/default.conf不变。跳过通知”

nginx-proxy-gen | 2019/05/04 15:16:25收到的活动开始容器2c49cd8d8e70

nginx-proxy-le |信息:创建了自定义Diffie-Hellman小组,已生成跳过。

nginx-proxy-le |重新加载Nginx docker-gen(使用单独的容器nginx-proxy-gen)...

nginx-proxy-gen | 2019/05/04 15:16:25收到信号:挂断

nginx-proxy-gen | 2019/05/04 15:16:25收到信号:挂断

nginx-proxy-le |重新加载nginx(使用单独的容器13025827c7d261016e17d1cf6965ad511c145accbd80e27bd25b302f81239f13)...

nginx-proxy-gen | 2019/05/04 15:16:25的内容/etc/nginx/conf.d/default.conf不变。跳过通知”

nginx-proxy-le | 2019/05/04 15:16:26产生“ / app / letsencrypt_service_data”(来自7个容器)>

nginx-proxy-le | 2019/05/04 15:16:26正在运行'/ app / signal_le_service'

nginx-proxy-le | 2019/05/04 15:16:26观看docker事件

nginx-proxy-le | 2019/05/04 15:16:26的内容/ app / letsencrypt_service_data不变。跳过通知'/ app / signal_le_service'

nginx-proxy-le | /etc/nginx/certs/btcsources.es / app

nginx-proxy-le |重新加载Nginx docker-gen(使用单独的容器nginx-proxy-gen)...

nginx-proxy-gen | 2019/05/04 15:16:26收到信号:挂断

nginx-proxy-gen | 2019/05/04 15:16:26收到信号:挂断

nginx-proxy-le |重新加载nginx(使用单独的容器13025827c7d261016e17d1cf6965ad511c145accbd80e27bd25b302f81239f13)...

nginx-proxy-le |正在创建/续订btcsources.es证书...(btcsources.es)

nginx-proxy-gen | 2019/05/04 15:16:26的内容/etc/nginx/conf.d/default.conf不变。跳过通知”

nginx-proxy-le | 2019-05-04 15:16:26,833:INFO:simp_le:1564:证书已经存在,无需更新,请退出状态码1。

nginx-proxy-le | / app

nginx-proxy-le | /etc/nginx/certs/rociocorbart.es / app

nginx-proxy-le |正在创建/续订rociocorbart.es证书...(rociocorbart.es)

nginx-proxy-le | 2019-05-04 15:16:27,456:INFO:simp_le:1564:证书已经存在,无需更新,请退出状态码1。

nginx-proxy-le | / app

nginx-proxy-le |睡眠3600秒

nginx-proxy-gen | 2019/05/04 15:16:30 Debounce minTimer开除

nginx-proxy-gen | 2019/05/04 15:16:30的内容/etc/nginx/conf.d/default.conf不变。跳过通知”

我一直遵循本教程来部署多个应用程序,而不是我以前在VPS中使用Docker的唯一应用程序。我已经修改了我的应用docker-compose.yml文件,添加了...

wordpress docker docker-compose apache2
1个回答
0
投票
当我将VIRTUAL_HOST设置为xxx.com(不带www)但使用www.xxx.com访问我的网站时,出现503错误。应该可以通过https://www.btcsources.es访问您的站点。否则,可能会出现503错误。如果是这样,则此链接可能是参考:https://github.com/jwilder/nginx-proxy/issues/444
© www.soinside.com 2019 - 2024. All rights reserved.