Apache2忽略虚拟主机

时间:2015-07-21 17:03:07

标签: magento apache2 virtualhost

我真的坚持这个。我有一个magento安装和一个apache2服务器。由于多线程,我需要映射一些这样的域:

/var/www/magento             -> Magento installation
/var/www/magento/bienenkorb  -> store1
/var/www/magento/sarto24     -> store2

如果我通过ip到达那里一切正常:

http://91.250.115.212/magento/bienenkorb/指向第一家商店

http://91.250.115.212/magento/sarto24/指向第二家商店

现在我将域(临时)http://bienenkorb24.eu映射到IP 91.250.115.212

然后我在/ etc / apache2 / sites-avalable中创建了一个bienenkorb24.eu.conf文件,并通过a2ensite激活它,其中包含:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin webmaster@domain1.com
    DocumentRoot /var/www/magento/bienenkorb
    ServerRoot /var/www/magento/bienenkorb
    ServerName bienenkorb24.eu
    <Directory /var/www/magento/bienenkorb>
      Require all granted
    </Directory>
</VirtualHost>

但我仍然登陆根(/ var / www)而不是store1地址。

有人能帮助我吗?

error.log中没有特殊错误:

Tue Jul 21 19:51:08 2015] [notice] Digest: generating secret for digest authentication ...
[Tue Jul 21 19:51:08 2015] [notice] Digest: done
[Tue Jul 21 19:51:08 2015] [notice] Apache/2.2.22 (Debian) DAV/2 mod_perl/2.0.7 Perl/v5.14.2 configured -- resuming normal operations
[Tue Jul 21 19:51:11 2015] [error] [client 66.249.64.224] File does not exist: /var/www/gmundner

1 个答案:

答案 0 :(得分:0)

尝试以下代码;

sudo gedit /etc/hosts
Add  this 127.0.0.1  bienenkorb24.eu #You can use your ip here

cd /etc/apache2/sites-available
sudo gedit /etc/apache2/sites-available/000-default.conf


Add following 
<VirtualHost *:80> 
    ServerName bienenkorb24.eu 
    DocumentRoot /var/www/html/bienenkorb24 

    <Directory /var/www/html/bienenkorb24> 
        DirectoryIndex index.php 
        AllowOverride All 
        Order allow,deny 
        Allow from all 
    </Directory> 
</VirtualHost>

apachectl configtest
sudo a2ensite bienenkorb24.eu 
sudo a2enmod rewrite
sudo service apache2 reload
chcon -R -t httpd_sys_rw_content_t /var/www/html/bienenkorb24/
chmod -R a+w /var/www/html/bienenkorb24/

根据需要更改文件夹路径,以备不时之需。如果一个正常工作,那么对其他域也一样。

希望它有所帮助!!

相关问题