Mat*_*iby 6 ubuntu virtualhost documentroot apache-2.2
好的,所以我刚刚启动了一个新的 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
Run Code Online (Sandbox Code Playgroud)
但我在启用站点的唯一文件是这个
<VirtualHost 23.21.197.126:80>
ServerAdmin something@gmail.com
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>
Run Code Online (Sandbox Code Playgroud)
有什么我遗漏的......文档根目录应该是/srv/crm/current/public
而不是/etc/apache2/htdocs
错误所暗示的
有想法该怎么解决这个吗
更新
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
Run Code Online (Sandbox Code Playgroud)
更新
<VirtualHost *:80>
ServerAdmin something@gmail.com
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>
Run Code Online (Sandbox Code Playgroud)
这听起来像 apache 没有找到您的启用站点的目录。
在 apache2.conf 文件 (etc/apache2/apache2.conf) 中查找如下行:
Include sites-enabled/
Run Code Online (Sandbox Code Playgroud)
将其更改为绝对路径,如下所示:
Include /etc/apache2/sites-enabled/
Run Code Online (Sandbox Code Playgroud)
这应该可以解决问题。