我已经编译Apache 2.4到Ubuntu的Linux桌面和configurationDocumentRoot指令指向/ usr / local / apache2 / htdocs。 而不是在configuration的DocumentRoot中提供index.html,apache不停地查看/ var / www。 我是否缺less一些configuration?
看来,Apache服务器实际的索引页面从/ var / www当我使用别名localhost作为url,而当使用127.0.0.1它服务于目录索引从documentroot目录
目标是将Apacheconfiguration为从本地主机url下的DocumentRoot提供目录索引
实际configuration:
DocumentRoot“/ usr / local / apache2 / htdocs”
<目录“/ usr / local / apache2 / htdocs”>
选项+索引
AllowOverride无
要求所有授予
</ Directory>
您需要一个ServerName指令来使用基于名称的虚拟主机。
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /usr/local/apache2/htdocs ServerName localhost <Directory /usr/local/apache2/htdocs> AllowOverride All Options -Indexes +FollowSymLinks Require all granted # turn Magento developer mode on # SetEnv MAGE_IS_DEVELOPER_MODE 1; </Directory>
确保localhostparsing为127.0.0.1请确保您的web根目录中有一个index.html文件
重新启动Apache
apache2 restart