当我在地址栏example.local中写入内容时,如何设置Apache2.2从htdocs/example/加载站点?
提前感谢
发布于 2011-07-30 04:56:29
您必须确保example.local解析到您的本地计算机,最简单的方法是添加一行代码,例如
127.0.0.1 example.local到您的hosts文件(linux: /etc/hosts;win:%SystemRoot%\system32\drivers\etc\hosts)。然后你需要在你的apache配置中有一个虚拟主机,比如(这是very basic)
<VirtualHost 127.0.0.1:80>
ServerName example.local
DocumentRoot /path/to/htdocs
ErrorLog /path/to/error.log
CustomLog /path/to/access.log combined
</VirtualHost>这样,您应该能够通过http://example.local/example/访问htdocs/example/中的文件
有关更多详细信息,请参阅fine apache manual
https://stackoverflow.com/questions/6878877
复制相似问题