2

第一次发帖,但请帮忙。我已经搜索和重新配置了 6 天,并且已经失去了几束头发。

问题:我想在我的 ubuntu 服务器上安装 2 个以上的虚拟主机(1 个 ip)但是 - 只有第一个“按字母顺序”列出的启用站点的节目。000-默认 www.domain1.com www.domain2.com

单独他们都工作(如果我 a2dissite 为每个离开 1)

配置:UBUNTU 10.10 服务器 EC2 实例(不要为这部分拍摄我 - 希望这不是问题!) APACHE 2.2.16 DNS my.domain.com - 到我的公共 ec2 dns(这有效)

虚拟主机:

默认

<VirtualHost *:80>
        DocumentRoot "/home/www/"
        <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Satisfy all
        </Directory>
        <Directory /home/www>
        Options Indexes Multiviews FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all
        </Directory>
        LogLevel debug
        ErrorLog /home/www/logs/error.log
        CustomLog /home/www/logs/access.log "combined"
</VirtualHost>

虚拟主机 1 - 域 1

<VirtualHost *:80>
        ServerAdmin webmaster@domain1.com
        ServerName domain1.com
        ServerAlias domain1.com www.domain1.com
        # Indexes + Directory Root.
        DirectoryIndex index.php
        DocumentRoot "/home/www/www.domain1.com/"
        # Directory directive
        <Directory "/home/www/www.domain1.com">
                Options Indexes Multiviews FollowSymLinks
                AllowOverride none
                Order allow,deny
                Allow from all
        </Directory>
        # CGI Directory
        ScriptAlias /cgi-bin/ /home/www/www.domain1.com/cgi-bin
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>
        # Logfiles
        LogLevel debug
        ErrorLog "/home/www/www.domain1.com/logs/error.log"
        CustomLog "/home/www/www.domain1.com/logs/access.log" combined
</VirtualHost>

我在另一个具有不同域名的文档根目录中也有 domain2 的上述内容

符号链接到位:我的 apache2ctl -St 显示以下 - VirtualHost 配置:

*:80       is a NameVirtualHost
         default server  (/etc/apache2/sites-enabled/000-default:4)
         port 80 namevhost  (/etc/apache2/sites-enabled/000-default:4)
         port 80 namevhost domain1.com (/etc/apache2/sites-enabled/www.domain1.com:4)
         port 80 namevhost www.domain2.com (/etc/apache2/sites-enabled/www.domain2.com:4)
Syntax OK

我的 ports.conf: NameVirtualHost *:80 Listen 80

<IfModule mod_ssl.c>
    NameVirtualHost *.443
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

我的 apache2.conf 和 httpd.conf 没有从默认更改为空。

我已经尝试了以下(以及大约一百个其他):

[URL="http://ubuntu-tutorials.com/2008/01/09/setting-up-name-based-virtual-hosting/"][/URL] [URL="http://httpd.apache. org/docs/2.2/rewrite/vhosts.html"]http://httpd.apache.org/docs/2.2/rewrite/vhosts.html[/URL] [URL="http://ubuntuforums.org/archive/ index.php/t-1466665.html"]http://ubuntuforums.org/archive/index.php/t-1466665.html[/URL] [URL="http://flurdy.com/docs/ec2/ basics/index.html"]http://flurdy.com/docs/ec2/basics/index.html[/URL] [URL="http://www.webmasterworld.com/apache/3282118.htm"]http ://www.webmasterworld.com/apache/3282118.htm[/URL]

似乎我已经尝试了其他所有人都遇到的所有问题,但似乎没有任何东西可以解决我的问题。

可能性:
1)EC2
2)文件的权限-我将所有内容都更改为 apache2 用户“www-data”-没有骰子。
3)我是个笨蛋……希望如此,你们中的一个好心人指出我的问题。:)

很快聊天......我会在这里失去我的头发。
问候, 洛甘萨诺

4

2 回答 2

0

DNS 是罪魁祸首。在 EC2、Ubuntu 和 Apache 中,一切都按预期通过。问题是我在 DNS 上使用 URL 重定向。这是愚蠢的!这很简单,我设置了一个 ANAME,而不是使用我的公共 IP 地址作为别名 (www.domain1.com) 和相同的 (www.domain2.com),并且一切正常。现在,如果我只能让 TOMCAT 与 mod_proxy 一起工作,我将 100% 存在!

于 2011-06-12T10:07:17.377 回答
0

不幸的是,Slicehost 将要关闭,但它有一些关于如何实现虚拟主机的很好的文档。
访问: http :
//articles.slicehost.com/2010/5/19/apache-virtual-hosts-on-ubuntu-part-1 http://articles.slicehost.com/2010/5/19/apache-virtual
-hosts-on-ubuntu-part-2

我已经离开 slicehost,但他们的文档仍然非常方便。

作为旁注,您可能在这里没有得到很多回应,因为这个问题更适合:
http ://serverfault.com

祝你好运,让我们知道出了什么问题,干杯!

于 2011-06-11T10:08:16.693 回答