关于Apache的25个初中级面试题
|
DirectoryIndex 的默认设置是 .html index.html index.php,如果不是这个名字,你需要对 httpd.conf 或者 apache2.conf 中的 DirectoryIndex 值做出修改,以将其展示在你的客户端浏览器上. # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # # The index.html.var file (a type-map) is used to deliver content- # negotiated documents. The MultiViews Option can be used for the # same purpose, but it is much slower. # DirectoryIndex index.html index.html.var index.cgi .exe 13. 当index文件丢失时如何使目录列表失效?答案 : 如果站点根目录中的主index文件失效,那么Apache将会在浏览器上列出所有内容类似的文件,以替换站点主页. 为了关闭Apache目录列表,你可以在主配置文件中全局的设置,或者在.htaccess文件中部分的设置如下规则. <Directory /var/www/html> Options -Indexes </Directory> 14. Apache Web 服务器有些什么不同的日志文件?答案 : Apache Web 服务器的默认日志文件是访问日志 “/var/log/httpd/access_log” 和错误日志:/var/log/httpd/error_log”. 15. 你是怎样理解错误日志中的“connection reset by peer”的?答案 : 当服务器正在向请求提供服务时终端用户中断连接,我们就会在错误日志中看到“connection reset by peer“. 16. 什么是Apache的虚拟主机?答案 : 虚拟主机部分包含的信息包括站点名称,文档根路径,目录索引,服务器管理员邮箱,错误日志文件路径等等。 你可以随意为你的域添加你需要的指令,但是要运行一个站点,至少要配置量个参数服务器名称和文档根目录。 在Linux机器上,通常我们在httpd.conf文件的末尾来设定我们的虚拟主机部分的相关配置。 虚拟主机示例 <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot /www/docs/dummy-host.example.com ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost>
17. <Location>和<Directory>之间有什么区别?答案 :
18. 什么是Apache虚拟托管?答案 : Apache虚拟托管是指,在单个web服务器上托管多个web站点。Apache 可以设定两种类型的虚拟主机:基于名称的虚拟托管和基于IP的虚拟主机托管。 更多相关信息,请参阅 如何在Apache中创建基于Name/IP的虚拟主机。 19. 你怎么理解Apache的MPM?答案 : MPM意思是Multi Processing Modules,实际上是指Apache遵循的一些机制,用来接受和完成对web服务器的请求。 20. Worker 和 Prefork MPM之间的区别是什么?答案 : 它们都是MPM,Worker 和 prefork 有它们各自在Apache上的运行机制. 它们完全依赖于你想要以哪一种模式启动你的Apache.
|

