我正在尝试使用 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
当我加载 http://magento.localhost.com直接在我的 Windows 机器上的浏览器中,我只会看到一个空白屏幕,但是如果我直接在 Ubuntu 的浏览器中访问 IP 192.168.43.95,它会向我显示 Web 服务器的“It works”默认页面。
任何人都知道我做错了什么以及为什么我无法通过 magento.localhost.com URL 访问它?
//更新
在我的 Windows 7 机器上,我可以(使用 cmd)毫无问题地 ping 192.168.0.77 地址,但是 ping magento.localhost.com 永远不会起作用?我猜我的主机设置不正确,有什么想法吗?
最佳答案
看起来您需要在 Windows 主机文件中添加一个条目。该文件位于 %SystemRoot%/system32/hosts
条目应如下所示:
192.168.0.77 vm
不要使用
localhost.com
这是一个实际的网站,不要覆盖默认的 localhost
条目 (127.0.0.1)然后您应该能够使用
magento.vm
访问您的站点。如果这不起作用,请告诉我
关于magento - 为 Magento 在 Virtual Box (Win 7) 上设置 Ubuntu 12.04 LTS 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22378498/