我在Windows 7中安装了Bitnami WAMP Stack,并试图运行eclipse代码。我在网上找到了一个链接,上面说要添加一个别名,但这不起作用,我如何让代码在其中运行
http://localhost/greenmugcafe/ 如果我的eclipse工作区位于这里
C:\Users\Robert\Documents\GitHub\greenmugcafe ?编辑:我在Bitnami中找不到任何东西,但是我在Bitnami堆栈中找到了一些。
有什么帮助吗?
发布于 2013-08-25 03:38:27
如果将localhost的虚拟主机目录更改为C:/Users/Robert/Documents/GitHub/,代码将从C:/Users/Robert/Documents/GitHub/运行。
就我个人而言,我认为最好是创建一个名为greenmugcafe.dev的本地域,而不是在localhost域中创建一个绿咖啡厅文件夹。
如何在中安装虚拟主机
确保已启用虚拟主机:
/installdir/apache2/conf/httpd.confhttpd-vhosts.conf的行,并通过删除开头的#取消注释添加一个新的虚拟主机:
hosts文件(通常位于C:\WINDOWS\system32\drivers\etc\)127.0.0.1 greenmugcafe.dev的末尾。这会告诉您的计算机,任何值为greenmugcafe.dev的url都应该被路由到127.0.0.1 (也就是localhost)。hosts文件,然后编辑此文件/installdir/apache2/conf/extra/httpd-vhosts.conf/installdir/apache2/conf/extra/httpd-vhosts.conf虚拟主机条目,保存并重新启动服务器。下面是代码:
#greenmugcafe
<VirtualHost *:80>
ServerAdmin webmaster@greenmugcafe.dev
DocumentRoot "C:/Users/Robert/Documents/GitHub/greenmugcafe/"
ServerName greenmugcafe.dev
ErrorLog "logs/greenmugcafe.dev-error.log"
CustomLog "logs/greenmugcafe.dev-access.log" common
<Directory "C:/Users/Robert/Documents/GitHub/greenmugcafe/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Require all granted
</Directory>
</VirtualHost>现在,C:/Users/Robert/Documents/GitHub/greenmugcafe/将指向http://greenmugcafe.dev
此方法也适用于其他WAMP堆栈,如Wamp Server和XAMPP。
对于在linux服务器上启动的网站,我们将更改域名的a record以指向服务器IP地址,而不是windows主机文件。然后,我们仍然需要设置虚拟主机,以便服务器知道识别域名并将其指向服务器上的正确文件夹。
希望这有帮助:)
https://stackoverflow.com/questions/17892223
复制相似问题