Apache 2多域还添加到Ubuntu 12.04

时间:2013-06-07 22:18:06

标签: apache2 ubuntu-12.04

很抱歉开始讨论以前讨论的内容。但我无法找到解决问题的正确方法。谢谢你的阅读。

我有一台VPS服务器,我使用/ etc / apache2 / sites-available / default文件为其添加了默认root。

我的默认文件是

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/root/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/root/>
            Options None
            AllowOverride None
            Order deny,allow
            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>

后来我添加了一个名为alfonsoapp.com的新域名,但是现在它可以在默认的root上运行,它是/ home / root / files /但是它应该在/ home / alfonsoapp / files上工作,我在哪里做错了?

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/alfonsoapp/files/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/alfonsoapp/files>
            Options None
            AllowOverride None
            Order deny,allow
            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>

1 个答案:

答案 0 :(得分:1)

我发现了问题。我应该在sites-available / alfonsoapp.com文件中添加这些代码

  ServerName  domain.com
  ServerAlias www.domain.com