apache2虚拟主机子域迁移

时间:2015-05-21 14:02:30

标签: apache2 virtualhost

electronicarchitect.com是旧域名, 我期待用rrh.com取代

我想要的: electronicarchitect.com:rrh.com portal.electronicarchitect.com:portal.rrh.com

目前,当我去portal.rrh.com时,出于某种原因我带我到rrh.com所在的位置

<VirtualHost *:80>
            ServerName electronicarchitect.com
            ServerAlias www.electronicarchitect.com

            DocumentRoot /var/www/electronicarchitect.com

            ErrorLog /etc/apache2/logs/electronicarchitect.com/error.log

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

            <Directory /var/www/electronicarchitect.com>
                    AllowOverride All
            </Directory>

            CustomLog /etc/apache2/logs/electronicarchitect.com/access.log combined
    </VirtualHost>


    <VirtualHost *:80>
            ServerName portal.electronicarchitect.com

            DocumentRoot /var/www/portal.electronicarchitect.com

            ErrorLog /etc/apache2/logs/portal.electronicarchitect.com/error.log

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

            <Directory /var/www/portal.electronicarchitect.com>
                    AllowOverride All
            </Directory>

            #alias /php-myadmin/ "/var/www/portal.electronicarchitect.com/php-myadmin/"
            #<Directory "/var/www/portal.electronicarchitect.com/php-myadmin">
            #        AllowOverride All
            #        Options FollowSymlinks
            #        Order allow,deny
            #        Allow from all
            #        DirectoryIndex index.php
            #</Directory>

            CustomLog /etc/apache2/logs/portal.electronicarchitect.com/access.log combined
    </VirtualHost>


    __
    <VirtualHost *:80>
    ServerName www.rrh.com
    ServerAlias rrh.com
    ServerAdmin webmaster@rrh.com

    DocumentRoot /var/www/electronicarchitect.com/

    <Directory /var/www/electronicarchitect.com/>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/electronicarchitect.com.error.log

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

    ServerSignature On
    </VirtualHost>


    <VirtualHost *:80>
    ServerName portal.rrh.com
    ServerAdmin webmaster@rrh.com

    DocumentRoot /var/www/portal.electronicarchitect.com/

    <Directory /var/www/portal.electronicarchitect.com/>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/rrh.error.log

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

    ServerSignature On
    </VirtualHost>

抱歉格式不佳,stackoverflow在创建此帖子时遇到了问题。

1 个答案:

答案 0 :(得分:2)

您是否设置了子CNAME?

CNAME记录指向子域:

portal.electronicarchitect.com(在这种情况下)

请记住,DNS可能需要一段时间才能更新/扩散。

设置Apache。 将sub添加到/ etc / apache2 / sites-available(您已经这样做了,包括供其他人参考。)

子:

<VirtualHost *:80>    
        ServerName subDomainName.myDomain.com    
            <Proxy *>
                Order deny,allow
                Allow from all
            </Proxy>    
            <Location />
                ProxyPass http://192.168.1.101/
                ProxyPassReverse http://192.168.1.101/
            </Location>    
</VirtualHost>