虚拟主机:Sites-available/myfilename.conf 结构

虚拟主机:Sites-available/myfilename.conf 结构

我有网址http://mydomain1在 apache 上本地运行。现在我想做http://mydomain2也可以访问。

我在 myfilename.conf 中添加了相应的标签

  <VirtualHost *:80>
        ServerName mydomain2       
        ServerAdmin webmaster@localhost
        DocumentRoot /home/myname/Documents/Workspace/mydomain2/
        <Directory /home/myname/Documents/Workspace/mydomain2/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
        ServerSignature On
</VirtualHost>
<VirtualHost *:80>
        ServerName mydomain1       
        ServerAdmin webmaster@localhost
        DocumentRoot /home/myname/Documents/Workspace/mydomain1/
        <Directory /home/myname/Documents/Workspace/mydomain1/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
        ServerSignature On
</VirtualHost>

我重新启动阿帕奇。

尽管如此,我仍然无法访问任何内容http://mydomain2,浏览器会将我重定向到 www.mydomain2.com。

相关内容