「nginx へようこそ」と「Apache2 Ubuntu デフォルト ページ」のデフォルト ページ

「nginx へようこそ」と「Apache2 Ubuntu デフォルト ページ」のデフォルト ページ

そこで私は、Proxmox VE 5.3 をメイン OS として搭載した物理サーバーを自宅に設置しました。Proxmox には 4 つの VM がインストールされています。

  • エンギンクス(Ubuntu 18.04 LTS VM にインストール)
  • 談話(Ubuntu 18.04 LTS VMにインストール済み)、HTTP用にセットアップ済み、HTTPSをセットアップする予定
  • ギットラボ(Ubuntu 18.04 LTS VMにインストール済み)、HTTP用にセットアップ済み、HTTPSをセットアップする予定
  • クラウド(Ubuntu 18.04 LTS VMにインストール)、HTTPS用にセットアップ

この設定の目的は、Nginx が他の 3 つの VM をリバース プロキシすることです。残念ながら、これにはかなり苦労しているようです。以下の表に、ブラウザーで表示される内容を示します。

----------------------------------------------------------------------------------------------------------------------------------------------------------
|    VM     |                URL                                    |                         What I get back in the Browser                             |
----------------------------------------------------------------------------------------------------------------------------------------------------------
| Discourse | http://discourse.myreserveddns.com                    | "Welcome to nginx!" default page                                                   |
| GitLab    | http://git.myreserveddns.com                          | Redirects to http://git.myreserveddns.com/users/sign_in, the page I expect to see. |
| ownCloud  | http://oc.myreserveddns.com                           | Redirects to https://oc.myreserveddns.com                                          |
| ownCloud  | https://oc.myreserveddns.com                          | "Apache2 Ubuntu Default Page"                                                      |
| ownCloud  | https://oc.myreserveddns.com/owncloud/index.php/login | I get the ownCloud login page, as I expect to see.                                 |
----------------------------------------------------------------------------------------------------------------------------------------------------------

つまり、GitLabは期待通りにリダイレクトしています。ownCloudでは完全なURLでログインページにアクセスすることができますが、次のようなシンプルなURLが本当に欲しいです。http://oc.myreservedns.com よりそしてhttps://oc.myreservedns.com よりログインURLとDiscourseにルーティングすると、「Welcome to nginx!」のデフォルトページしか表示されません。Discourseについては、適切なDiscourseページを取得できたことを述べておきます。http://discourse.myreservedns.com よりしかし、その後ブラウザでプライベート IP をテストしたところ、Nginx のデフォルト ページしか表示されません。

とにかく、/etc/nginx/sites-available にある Nginx conf ファイルは次のとおりです (そして、すべてに /etc/nginx/sites-enabled へのシンボリック リンクが含まれています)。

談話.conf

server {
# The IP that you forwarded in your router (nginx proxy)
  listen 192.168.1.101:80; listen [::]:80;

# Make site accessible from http://localhost/
 server_name discourse.myreserveddns.com;

# The internal IP of the VM that hosts your Apache config
 set $upstream 192.168.1.104;

 location / {

 proxy_pass_header Authorization;
 proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
 proxy_set_header Host $http_host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto $scheme;
 proxy_http_version 1.1;
 proxy_set_header Connection "";
 proxy_buffering off;
 client_max_body_size 0;
 proxy_read_timeout 36000s;
 proxy_redirect off;

 }
}

gitlab.conf (コードも含めたいのですが、投稿がスパムのように見えると言われており、他の CONF ファイルを表示するよりも重要度が低いです)

独自のクラウド.conf

server {
# The IP that you forwarded in your router (nginx proxy)
  listen 192.168.0.101:443 ssl;

# SSL config
 ssl on;
 ssl_certificate /etc/nginx/ssl/owncloud.crt;
 ssl_certificate_key /etc/nginx/ssl/owncloud.key;

# Make site accessible from http://localhost/
 server_name oc;

# The internal IP of the VM that hosts your Apache config
 set $upstream 192.168.0.102;

 location / {

 proxy_pass_header Authorization;
 proxy_pass https://$upstream;
 proxy_set_header Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_http_version 1.1;
 proxy_set_header Connection "";
 proxy_buffering off;
 client_max_body_size 0;
 proxy_read_timeout 36000s;
 proxy_redirect off;

 }
}

それで、私は主に2つの質問があると思います:

  1. 「Welcome to nginx!」と「Apache2 Ubuntu Default Page」というデフォルト ページが表示されるのはなぜですか? Nginx でこれらの「デフォルト」ページはどこにありますか?
    • デフォルトの Apache ページは、ownCloud にとっては非常に奇妙です。SSL 用に Apache を実行しているため、デフォルトのページは ownCloud VM 上にある可能性があります。一方、Discourse には Nginx がまったくインストールされていません。
  2. Nginxでリンクから別のリンクにリダイレクトできますか?例えば、https://oc.myreservedns.com よりhttps://oc.myreservedns.com/owncloud/index.php/ログイン?

関連情報