【问题标题】:Issue with setting up Ubuntu 12.04 LTS on Virtual Box (Win 7) for Magento为 Magento 在 Virtual Box (Win 7) 上设置 Ubuntu 12.04 LTS 的问题
【发布时间】:2014-03-13 12:21:32
【问题描述】:

我正在尝试使用 Virtual box(在 Windows 7 中)设置 Ubuntu 12.04 LTS,以使我能够进行一些 Magento 开发。

我使用了“Magento,开发人员指南”一书中的以下指南,并针对主机文件设置了以下内容(直接来自该书):

我在 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

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

有人知道我做错了什么以及为什么我无法通过 magento.localhost.com URL 访问它吗?

// 更新

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

【问题讨论】:

  • 你在 windows 的 hosts 文件中有什么?

标签: magento ubuntu virtualbox virtualization hosts


【解决方案1】:

看起来您需要在 Windows 主机文件中添加一个条目。该文件可以在%SystemRoot%/system32/hosts 找到,并且条目应如下所示:

192.168.0.77     vm

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

然后您应该可以使用magento.vm 访问您的网站

如果这不起作用,请告诉我

【讨论】:

  • 仍然没有乐趣.. 我添加了一个显示主机文件的 pastebin,您可能会觉得这些文件很有用。 pastebin.com/dJeyeFgE
  • @Zabs,pastebin 显示您在 vm 行上缺少 7
  • 你还是不能 ping magento.vm ?
  • 甜蜜!这似乎现在可以工作了:-)我现在必须弄清楚为什么它没有向我显示默认的 Magento 安装页面(它只显示 It works 页面)但这是一个问题,感谢伙伴 :)
【解决方案2】:

好的,我通常在 Windows 7 上的 VirtualBox 中使用 Ubuntu Server,所以我是这样做的。

当我安装 Ubuntu Server 时,我确保我检查了 ssh、LAMP、邮件和 Samba 选项。

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

我在 Samba 中设置了一个文件夹 /etc/samba/smb.conf,这样我就可以将我的 /var/www/site 文件夹映射到 Windows 中的一个新字母下。 最后,我将 Windows 中的 system32/hosts 文件更改为指向静态 ip 192.168.56.x,并使用 VirtualHost 配置中的 ServerName 或 ServerAlias。

192.168.56.x magento.localhost.com

【讨论】:

    猜你喜欢
    • 2013-05-08
    • 1970-01-01
    • 1970-01-01
    • 2013-10-17
    • 2015-05-16
    • 2014-01-07
    • 2013-11-09
    • 1970-01-01
    • 2013-09-12
    相关资源
    最近更新 更多