我已经意外删除了虚拟主机文件010-foo.conf 。 Apache2.4目前仍在运行,无需reload或restart 。 有没有办法看到实际configuration的文件,不存在更多(也许通过apachectl命令或其他)?
如果您没有安装mod_info,则可以使用gcore将父进程(由pid 1拥有的进程)转储到文件,然后search“VirtualHost”或其他内容。 我只是在我的系统上testing它,它工作。 你将不得不像grep一样乱掉你想要的东西并replaceconfiguration文件。
gcore <pid> less core.<pid>
编辑(从OP):
如果你没有gcore ,你可以通过apt-get install gdb (Ubuntu) apt-get install gdb 。 pid文件通常位于/var/run/apache2/apache2.pid下。 然后你可以执行上面提到的命令并search二进制文件,例如用grep -obUaP "text to search" <dump file> , 在这里可以看到关于使用grep for binary文件的更多信息。
如果你安装了mod_info ,你可以使用它来打印你的服务器configuration 。 就我而言,我可以看到Apache所看到的整个configuration,包括所有的VirtualHosts。
如果你没有安装mod_info并且已经在使用,那么这个信息可能对你不可用。
您也可以使用httpd -S在命令行上看到一些VirtualHost信息。 这不是完整的,但最好不要:
-S Show the settings as parsed from the config file (currently only shows the virtualhost settings).