Ubuntu 10.10 + apache:vhost 不工作

Ubuntu 10.10 + apache:vhost 不工作

我家里有一台 Ubuntu 10.10 桌面系统,用于开发目的。出于某种原因,我无法让虚拟主机正常工作。在工作中,我有一个几乎类似的设置(完全由我完成),Apache 和 vhost 正常工作。

  • 主机:我已将本地域名添加到 hosts 文件中,这似乎有效。我看到了默认主机页面。
  • 下面您可以看到我已启用的模块以及已启用的站点。
  • 我已经重新启动了 Apache

我不知道我在这里缺少什么才能使这个工作正常进行。


* apache.conf *

Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

* mods 已启用 *

lrwxrwxrwx 1 root root   28 2009-07-28 23:20 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root   28 2009-07-28 23:20 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root   36 2009-07-28 23:20 authz_default.load -> ../mods-available/authz_default.load
lrwxrwxrwx 1 root root   38 2009-07-28 23:20 authz_groupfile.load -> ../mods-available/authz_groupfile.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root   33 2009-07-28 23:20 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root   32 2009-07-28 23:20 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root   32 2009-07-28 23:20 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 cgi.load -> ../mods-available/cgi.load
lrwxrwxrwx 1 root root   30 2009-07-28 23:20 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root   30 2009-07-28 23:20 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root   26 2009-07-28 23:20 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root   34 2009-07-28 23:20 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root   34 2009-07-28 23:20 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 php5.conf -> ../mods-available/php5.conf
lrwxrwxrwx 1 root root   27 2009-07-28 23:20 php5.load -> ../mods-available/php5.load
lrwxrwxrwx 1 root root   33 2010-05-26 21:49 reqtimeout.conf -> ../mods-available/reqtimeout.conf
lrwxrwxrwx 1 root root   33 2010-05-26 21:49 reqtimeout.load -> ../mods-available/reqtimeout.load
lrwxrwxrwx 1 root root   31 2009-07-28 23:20 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root   31 2009-07-28 23:20 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root   29 2009-07-28 23:20 status.conf -> ../mods-available/status.conf
lrwxrwxrwx 1 root root   29 2009-07-28 23:20 status.load -> ../mods-available/status.load
lrwxrwxrwx 1 root root   34 2010-11-25 11:12 vhost_alias.load -> ../mods-available/vhost_alias.load

* 已启用站点 *

lrwxrwxrwx 1 root root   26 2009-07-28 23:20 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root   32 2010-11-13 22:03 test.local -> ../sites-available/test.local

* 消息 *

Nov 25 15:10:56 ubuntu-rxt kernel: [234402.009386] [UFW BLOCK] IN=eth0 OUT= MAC=00:0e:2e:b8:72:59:00:24:fe:d4:bc:02:08:00 SRC=192.168.178.1 DST=192.168.178.26 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=14809 DF PROTO=TCP SPT=4913 DPT=14013 WINDOW=5840 RES=0x00 SYN URGP=0

*错误日志*

[Thu Nov 25 15:13:57 2010] [notice] caught SIGTERM, shutting down
[Thu Nov 25 15:13:58 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4 with Suhosin-Patch configured -- resuming normal operations

*访问日志*

127.0.0.1 - - [25/Nov/2010:15:15:24 +0100] "GET / HTTP/1.1" 304 211 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3"

* 主办方 *

127.0.0.1   localhost test.local
127.0.1.1   ubuntu-rxt

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

* 测试.本地 *

<VirtualHost *:80>
DocumentRoot /var/www-vhosts/test.local
<Directory /var/www-vhosts/test.local/>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>
</VirtualHost>

* 默认 *

<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 /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/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>

答案1

您是否不需要ServerName/ServerAlias来代表网站?请查看此处:

相关内容