Apache와 함께 Discourse Docker 실행하기

안녕하세요.

기존 서버에 Discourse 도커를 설정하려고 합니다. 다른 도커 컨테이너는 실행하지 않고 있습니다.

서버에는 Apache(WordPress 웹사이트)와 기타 웹 서비스가 실행 중입니다.

서브도메인 'forum.rebelscience.club’을 도커 컨테이너로 라우팅하는 방법을 모르겠습니다.

아래와 같이 질문을 받을 때:

Hostname for your Discourse? [discourse.example.com]: forum.rebelscience.club

다음과 같은 내용을 확인합니다:

Checking your domain name . . .
WARNING: Port 443 of computer does not appear to be accessible using hostname:  forum.rebelscience.club.
WARNING: Connection to http://forum.rebelscience.club (port 80) also fails.

This suggests that forum.rebelscience.club resolves to some IP address that does not reach this 
machine where you are installing discourse.

The first thing to do is confirm that forum.rebelscience.club resolves to the IP address of this server.
You usually do this at the same place you purchased the domain.

If you are sure that the IP address resolves correctly, it could be a firewall issue.
A web search for "open ports YOUR CLOUD SERVICE" might help.

This tool is designed only for the most standard installations. If you cannot resolve
the issue above, you will need to edit containers/app.yml yourself and then type

./launcher rebuild app

어떻게 설정해야 할지 확실하지 않습니다. 포트 80/443은 사용 가능하지만, 제 주 도메인으로 지정되어 있고 서브도메인으로 지정되어 있지 않습니다.

팁을 주시면 매우 감사하겠습니다.

@rebelCoder 님 안녕하세요

이 주제는 여기서(meta) 이미 충분히 논의되었고, meta에서 apache reverse proxy를 검색하면 포괄적이고 매우 상세한 주제들을 여러 개 찾을 수 있습니다.

요약하자면, apache 서버의 가상 호스트를 Discourse로 가는 reverse proxy로 설정해야 합니다.

이 설정에 대한 정확한 apache2 구성은 meta에 여러 번 게시된 바 있습니다.

도움이 되길 바랍니다.

죄송합니다. 이 포럼과 Digital Ocean에서 몇 가지 해결책을 찾아보고 시도해 보았다는 점을 언급해야 했습니다. 하지만 여전히 작동하지 않습니다. 저는 이전에 docker를 설정해 본 적이 없습니다.

현재 설정을 공유하겠습니다:

/ets/hosts:
127.0.0.1       forum.rebelscience.club

호스트 파일과 DNS 레코드는 오늘 phpBB를 해당 도메인에서 실행했었기 때문에 정상적으로 작동합니다. 이제 이를 Discourse가 실행되는 docker로 연결하려고 시도하고 있습니다.

containers/app.yml 파일에서

포트 설정을 다음과 같이 업데이트했습니다:

expose:
  - "8081:80"   # http
  - "8443:443" # https

/etc/apache2/sites-enabled/discourse.conf 파일에서는 다음과 같이 설정했습니다:

<VirtualHost *:80>
  ServerName forum.rebelscience.club
  ServerAlias www.forum.rebelscience.club

  <IfModule proxy_module>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8081/
    ProxyPassReverse / http://localhost:8081/
  </IfModule>
</VirtualHost>

무엇이 더 부족한가요? ./discourse-setup을 실행하면 여전히 원래 게시글에 언급된 메시지와 함께 실패합니다.

443 포트에 대한 가상 호스트가 있어야 한다고 생각합니다. 그렇다면 80 포트 오류는 이상하네요. DNS 설정에서 무언가(예: CNAME 레코드)가 누락된 것은 아닌지 확인해 보세요.

이상하네요. 설정하는 과정이 좀 지나치게 번거로운 것 같습니다.

forum.rebelscience.club에 A 레코드만 가지고 있습니다.

인증서도 추가해서 .conf 파일들을 업데이트했습니다:

cat /etc/apache2/sites-enabled/discourse.conf

<VirtualHost *:80>
  ServerName forum.rebelscience.club
  ServerAlias www.forum.rebelscience.club

  <IfModule proxy_module>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8081/
    ProxyPassReverse / http://localhost:8081/
  </IfModule>
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.forum.rebelscience.club [OR]
RewriteCond %{SERVER_NAME} =forum.rebelscience.club
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

cat /etc/apache2/sites-enabled/discourse-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerName forum.rebelscience.club
  ServerAlias www.forum.rebelscience.club

  <IfModule proxy_module>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8081/
    ProxyPassReverse / http://localhost:8081/
  </IfModule>

SSLCertificateFile /etc/letsencrypt/live/forum.rebelscience.club/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/forum.rebelscience.club/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

이제 **503 Service Unavailable**가 표시됩니다.

전혀 모르겠습니다. 다른 무엇을 해야 하는지 알려주세요. setup.sh는 여전히 원래 메시지와 함께 실패합니다.

위 (예시 설정)의 경우, Docker에서는 포트 8081만 노출해야 합니다(포트 80이나 443은 아닙니다).

포트 80과 443은 컨테이너 외부의 리버스 프록시에서 노출되며, 해당 트래픽은 포트 8081(위 예시에서와 같이)로 프록시됩니다. 이는 컨테이너 내부에서 노출(호스트의 80으로 매핑됨)한 포트입니다.

이것은 컨테이너 내부의 포트 80을 포트 8081(호스트에 노출됨)로 매핑한 경우에만 작동합니다.

expose:
  - "8081:80"   # http

도움이 되길 바랍니다.

PS: @rebelCoder, SSL 측의 apache2 설정에 필요한 설정 정보가 많이 빠져 있습니다.

이 포스트를 참고하세요:

이 문제는 더 이상 존재하지 않으므로 닫을 수 있습니다.

discourse-setup을 사용할 수 없습니다. Apache로 실행하는 방법에 대한 주제에서 설명된 대로 app.yml 파일을 수동으로 편집해야 합니다.