こんにちは。
既存のサーバーで Discourse の Docker 環境を設定しようとしています。現在、他の Docker コンテナは実行していません。
サーバーでは Apache(WordPress サイト)やその他の Web サービスが動作しています。
サブドメイン ‘forum.rebelscience.club’ を Docker コンテナにルーティングする方法がわかりません。
以下のような質問が出たとき:
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 は利用可能ですが、メインドメイン向けに設定されており、サブドメイン向けには設定されていません。
何かヒントがあれば、非常に助かります。
neounix
(Dark Matter)
2020 年 8 月 21 日午前 7:20
2
rebelCoder:
どんなヒントでも大歓迎です。
@rebelCoder さん、こんにちは
このトピックはメタで既に詳しく議論されています。メタで「apache reverse proxy」と検索すると、包括的で非常に詳細なトピックが多数見つかります。
要するに、Apache サーバーのバーチャルホストを Discourse へのリバースプロキシとして設定する必要があります。
この設定に必要な Apache2 の正確な構成については、メタで何度も投稿されています。
参考になれば幸いです。
「いいね!」 3
すみません、このフォーラムと 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 を実行しても、元の投稿に記載されたメッセージで失敗したままです。
Benjamin_D
(Benjamin Decotte)
2020 年 8 月 21 日午前 8:08
4
443 ポート用の仮想ホストを設定すべきだと思います。とはいえ、80 ポートのエラーは奇妙ですね。DNS に何か不足している(CNAME など)かもしれません。
奇妙ですね。設定が少し面倒すぎるようです。
forum.rebelscience.club には A レコード しかありません。
cert を含めて .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 は依然として元のメッセージで失敗しています。
neounix
(Dark Matter)
2020 年 8 月 21 日午前 9:00
6
rebelCoder:
8081
上記の例(設定例)では、Docker 側でポート 8081 のみを開く必要があります(ポート 80 や 443 は開かないでください)。
ポート 80 と 443 はコンテナ外のリバースプロキシによって公開されており、そのトラフィックは上記の例ではポート 8081(コンテナ内部で 80 にマッピングされているポート)へプロキシされます。
これは、コンテナ内部のポート 80 をホストに公開されているポート 8081 にマッピングしている場合にのみ機能します。
expose:
- "8081:80" # http
これが参考になれば幸いです。
追伸:@rebelCoder さん、SSL 側の apache2 設定には、必要な設定情報が不足しています。
以下の投稿をご覧ください:
Dear @Teraterayuki …
Here is an example set of working Apache2 virtual hosts for a reverse proxy to a unix domain socket in a Discourse container:
Port 80
<VirtualHost *:80>
ServerName mysite.mydomain.com
ServerAdmin webmaster@localhost
ProxyPreserveHost On
#ProxyPass / http://127.0.0.1:8888/
#ProxyPassReverse / http://127.0.0.1:8888/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.…
「いいね!」 1
pfaffman
(Jay Pfaffman)
2020 年 8 月 21 日午後 1:20
8
discourse-setupを使用することはできません。Apacheで実行する方法に関するトピックに記載されている通り、app.ymlを手動で編集する必要があります。