为什么我在日志中得到这个错误?

好吧,所以我刚开始一个新的Ubuntu服务器11.10,我添加了虚拟主机,一切似乎好…我也重新启动Apache,但是当我访问浏览器,我得到一个空白页

服务器IP是http://23.21.197.126/,但是当我尾日志

tail -f /var/log/apache2/error.log [Wed Feb 01 02:19:20 2012] [error] [client 208.104.53.51] File does not exist: /etc/apache2/htdocs [Wed Feb 01 02:19:24 2012] [error] [client 208.104.53.51] File does not exist: /etc/apache2/htdocs 

但我唯一的网站启用文件是这样的

 <VirtualHost 23.21.197.126:80> ServerAdmin [email protected] ServerName logicxl.com # ServerAlias DocumentRoot /srv/crm/current/public ErrorLog /srv/crm/logs/error.log <Directory "/srv/crm/current/public"> Order allow,deny Allow from all </Directory> </VirtualHost> 

有什么我失踪…..文件根目录应该是/srv/crm/current/public而不是/etc/apache2/htdocs的错误build议

有想法该怎么解决这个吗

UPDATE

 sudo apache2ctl -S VirtualHost configuration: 23.21.197.126:80 is a NameVirtualHost default server logicxl.com (/etc/apache2/sites-enabled/crm:1) port 80 namevhost logicxl.com (/etc/apache2/sites-enabled/crm:1) Syntax OK 

UPDATE

  <VirtualHost *:80> ServerAdmin [email protected] ServerName logicxl.com DocumentRoot /srv/crm/current/public <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /srv/crm/current/public/> Options Indexes FollowSymLinks MultiViews AllowOverride None 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 </VirtualHost> 

这听起来像apache没有find您的网站启用目录。
在你的apache2.conf文件(etc / apache2 / apache2.conf)中查找这样一行:

 Include sites-enabled/ 

将其更改为如下所示的绝对path:

 Include /etc/apache2/sites-enabled/ 

这应该做的伎俩。

这可能是由于:

 <VirtualHost 23.21.197.126:80> 

http://localhost任何请求都可能错过了最初的虚拟主机定义。

然后,您(正确)将其更改为:

 <VirtualHost *:80> 

除非你有一个特定的原因,否则你应该总是使用*:80来定义要监听的地址。 ServerName定义要响应的名称。 例如:

 NameVirtualHost *:80 <VirtualHost *:80> ... </VirtualHost> 

您忘了将新网站添加到apache:

 $ sudo a2ensite (your project name) 

我有同样的问题。 然而,就我而言,这只是由于…站点可用/默认没有链接到网站启用/默认。

在apache2.conf中我有:

 Include sites-enabled/ 

而我的网站启用/默认:

 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </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> 

检查您正在查询的接口IP是否有VirtualHost指令。 发生这个错误,就像上面详细描述的那样,当apache找不到服务器configuration来回答你的查询 – 但是它正在监听ports.conf。

系统升级后,我的错误也完全一样。 我修改了UserDir /etc/apache2/mods-enabled/userdir.conf 。 原版的:

 Userdir public_html 

新:

 Userdir /home/*/public_html 

现在工作很好:)