1

I want to connect to my nextcloud server via https, so I set up an Nginx server to handle it. Nextcloud and Nginx both run in docker. Https works, but when I try to connect I get "502 Bad Gateway". I can also access nextcloud over 192.168.0.28:7070, so its running.

cloud.conf

upstream cloud {
  server        localhost:7070;
}

server {
  listen        443 ssl;
  server_name   192.168.0.28;
  
  access_log /etc/nginx/logs/cloud.access.log;
  error_log /etc/nginx/logs/cloud.error.log;
  
  include       common.conf;
  include       /etc/nginx/ssl.conf;

  location / {
    proxy_pass  http://cloud;
    include     common_location.conf;
  }
}

error.log

2020/11/27 11:41:26 [error] 210#210: *114 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.178, server: 192.168.0.28, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:7070/", host: "192.168.0.28"
2020/11/27 11:41:26 [error] 210#210: *114 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.178, server: 192.168.0.28, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:7070/", host: "192.168.0.28"

cloud.yml

version: '2'

volumes:
  cloud:
  db:

services:
  db:
    container_name: cloud_database
    hostname: cloud_database
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: "unless-stopped"
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD= password
      - MYSQL_PASSWORD= password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    container_name: cloud
    hostname: cloud
    image: nextcloud
    links:
      - db
    volumes:
      - /var/docker/cloud:/var/www/html
      - /etc/localtime:/etc/localtime:ro
    restart: "unless-stopped"
    ports:
      - 7070:80
ph1l1pp
  • 11
  • 2

0 Answers0