我正在运行Linux的薄荷,我试图用apachebuild立一个虚拟主机。
我在/ etc / apache2 / sites-available /中添加了以下文件(它从该目录中的“默认”文件中复制)
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName testsite.dev DocumentRoot /home/chris/Projects/web/testsite <Directory /home/chris/Projects/web/testsite> Allow from all AllowOverride All Order allow,deny </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>
我还在我的主机文件(/ etc / hosts)中添加了一个条目:
127.0.0.1 testsite.dev
我也启用了该网站,并重新加载的Apache服务:
a2ensite testsite service apache2 reload
但是,当我浏览到http://testsite.dev它是从/ var / www /而不是/ home / chris / Projects / web / testsite提供页面。
我究竟做错了什么?
我会检查几件事情:
如果你通过所有这些,仍然不能得到你想要的东西,我会创build一个最小的Apacheconfiguration集(移动所有现有的configuration,并创build临时的configuration),并开始改变一步一步,看看事情出错了