代码之家  ›  专栏  ›  技术社区  ›  Zabs

为Magento在Virtual Box(Win 7)上安装Ubuntu 12.04 LTS时出现问题

  •  0
  • Zabs  · 技术社区  · 11 年前

    我正在尝试使用Virtualbox(在Windows7中)安装Ubuntu 12.04 LTS,以使我能够进行一些Magento开发。

    我已经使用了“Magento,the Developers guide”一书中的以下指南,并且我已经针对主机文件设置了以下内容(直接从该书中获取):

    我在Ubunto上的虚拟主机文件

    $ sudo nano /etc/apache2/sites-available/magento.localhost.com
    
    <VirtualHost *:80>
        ServerAdmin magento@locahost.com
        ServerName magento.localhost.com
        DocumentRoot /srv/www/magento_dev/public_html
     <Directory /srv/www/magento_dev/public_html/>
        Options Indexes FollowSymlinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>
        ErrorLog /srv/www/magento_dev/logs/error.log
        LogLevel warn
    </VirtualHost>
    

    Apache2、MySQL&PHP都已经在Ubuntu安装上安装和配置,我已经通过SVN下载了Magento源代码(例如/srv/www/Magento_dev/public_html)

    We just need to set up a local mapping into our host system host file by using any of the following:
    • Windows
     i. Open C:\system32\drivers\etc\hosts in notepad
     ii. Add the following line at the end of the file: 192.168.43.95 magento.localhost.com
    
    • Unix/Linux/OSX
     i. Open /etc/hosts using nano: $ sudo nano /etc/hosts
     ii. Add the following line at the end of the file: 192.168.43.95 magento.localhost.com
    

    当我加载 http://magento.localhost.com 直接在我的Windows机器上的浏览器中,我只得到一个空白屏幕,但是如果我直接在Ubuntu的浏览器中转到IP 192.168.43.95,它会显示web服务器的“它工作”默认页面。

    有人知道我做错了什么,为什么我不能通过magento.localhost.com URL访问?

    //更新

    在我的Windows 7机器上,我可以(使用cmd)ping 192.168.0.77地址,但没有问题,但是ping magento.localhost.com永远不会工作?我猜我的主机设置不正确,有什么想法吗?

    2 回复  |  直到 11 年前
        1
  •  1
  •   David Wilkins    11 年前

    看起来您需要在windows主机文件中添加一个条目。该文件位于 %SystemRoot%/system32/hosts 条目应如下所示:

    192.168.0.77     vm
    

    不要使用 localhost.com 这是一个实际的网站,不要覆盖默认值 localhost 条目(127.0.0.1)

    然后,您应该能够使用 magento.vm

    如果不起作用,请告诉我

        2
  •  0
  •   Emi    11 年前

    好的,我通常在Windows7上的VirtualBox中使用Ubuntu服务器,所以我是这样做的。

    安装Ubuntu Server时,我确保检查ssh、LAMP、mail和Samba选项。

    安装后,我将VM的设置更改为具有另一个网络适配器-我在NAT上使用一个,在主机上仅使用一个。 在ubuntu中,我编辑文件 /etc/network/interfaces 并在192.168.56.x类中为第一个适配器添加一个动态地址,为第二个适配器添加静态地址(将x值从1更改为255)。重新启动网络服务后,当您运行时,应该会看到类似eth0 10.0.2.*和eth1 192.168.56.x的内容 ifconfig -a

    我在Samba中设置了一个文件夹 /etc/samba/smb.conf 这样我就可以绘制我的 /var/www/site 在Windows中的新信件下的文件夹。 最后我改变了 system32/hosts 文件,指向VirtualHost配置中带有ServerName或ServerAlias的静态ip 192.168.56.x。

    192.168.56.x magento.localhost.com