2

Apache(Ubuntu)開発マシンで実行されているすべての仮想ホストを表示するスクリプトを作成できるようにしたいと考えています。

今日まで、私が欲しいものに近い例や何かを見つけていません。それは単に次のとおりです。

「このマシンで実行されているすべての仮想ホストを表示します」。(ServerName、Aliasなど)。

vhostsのすべてのconfファイルを格納する/etc/ apache2 / sites-availableフォルダーを読み取ることができるかもしれないと思っていましたが、その先に進む前に、まずここで質問したいと思いました。

4

1 に答える 1

4

apachectl(またはapache2ctl)コマンドを使用して、httpd仮想ホスト情報をダンプするようにApacheサーバーに通知できます。

 apache2ctl -St

apachectlを使用してシグナルとhttpdフラグを送信するためのリンクは次のとおりです。

これが私のApache/Ubuntuシステムでの様子です(私はたくさんの仮想ホストを持つWeb開発者です):

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost adaleco (/etc/apache2/sites-enabled/adaleco:1)
         port 80 namevhost amcham (/etc/apache2/sites-enabled/amcham:1)
         port 80 namevhost cake (/etc/apache2/sites-enabled/cake:1)
         port 80 namevhost cakeplate (/etc/apache2/sites-enabled/cakeplate:1)
         port 80 namevhost coord (/etc/apache2/sites-enabled/coord:1)
         port 80 namevhost dru1 (/etc/apache2/sites-enabled/dru1:1)
         port 80 namevhost flaming (/etc/apache2/sites-enabled/flaming:1)
         port 80 namevhost flaming6 (/etc/apache2/sites-enabled/flaming6:1)
         port 80 namevhost food (/etc/apache2/sites-enabled/food:1)
         port 80 namevhost fun (/etc/apache2/sites-enabled/fun:1)
         port 80 namevhost marc (/etc/apache2/sites-enabled/marc:1)
         port 80 namevhost sugar (/etc/apache2/sites-enabled/sugar:1)
         port 80 namevhost vol (/etc/apache2/sites-enabled/vol:1)
         port 80 namevhost xmas (/etc/apache2/sites-enabled/xmas:1)
Syntax OK
于 2013-03-26T20:57:15.600 に答える