AWS / PHP / Python ちょいメモ

amazon web service , PHP, Python を使ったときのメモ。日本語でググってもわからなかった事を中心に。

Apache で VirtualHost一覧を表示

久しぶりに触るたびに、忘れてる気がするのでメモ。

簡単なコマンド:

apachectl -S

VirtualHostのみを表示する場合:

apachectl -t -D DUMP_VHOSTS


すごく便利ですよね?Apache使いなら、当たり前なのだろうと思いつつも。


出力例: Redhat + SCL という環境なのでコマンドパスが特殊)

$ /opt/rh/httpd24/root/usr/sbin/apachectl -S
VirtualHost configuration:
 *:80                   is a NameVirtualHost
         default server aaa.bbb.ccc.ddd (/opt/rh/httpd24/root/etc/httpd/conf.d/000_serverip.conf:5)
         port 80 namevhost serviceone.domain.local (/opt/rh/httpd24/root/etc/httpd/conf.d/001_serviceone.conf:8)
         port 80 namevhost servicetwo.domain.local (/opt/rh/httpd24/root/etc/httpd/conf.d/002_servicetwo.conf:1)
ServerRoot: "/opt/rh/httpd24/root/etc/httpd"
Main DocumentRoot: "/opt/rh/httpd24/root/var/www/html"
Main ErrorLog: "/opt/rh/httpd24/root/etc/httpd/logs/error_log"
...


apachectl の ヘルプ:

$ sudo /opt/rh/httpd24/root/usr/sbin/apachectl -h
Usage: /opt/rh/httpd24/root/usr/sbin/httpd [-D name] [-d directory] [-f file]
                                           [-C "directive"] [-c "directive"]
                                           [-k start|restart|graceful|graceful-stop|stop]
                                           [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
  -D name            : define a name for use in  directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed vhost settings
  -t -D DUMP_RUN_CFG : show parsed run settings
  -S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check
  -X                 : debug mode (only one worker, do not detach)