[英]The requested URL could not be retrieved while trying to access Laravel project on Virtual Host
I want to create a virtual host for my Laravel project with XAMPP, so I have followed these steps:我想用 XAMPP 为我的 Laravel 项目创建一个虚拟主机,所以我按照以下步骤操作:
Step 1) C:\\WINDOWS\\system32\\drivers\\etc\\
Opened the "hosts" file (as Administrator):步骤 1) C:\\WINDOWS\\system32\\drivers\\etc\\
打开“hosts”文件(以管理员身份):
127.0.0.1 localhost
127.0.0.1 test.com
Step 2) xampp\\apache\\conf\\extra\\httpd-vhosts.conf
步骤 2) xampp\\apache\\conf\\extra\\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:/Users/User 1/Desktop/POUYA/freedeliveries" <= PROJECT DIRECTORY
ServerName www.test.com
</VirtualHost>
Step 3) C:\\xampp\\apache\\conf\\httpd.conf
.步骤 3) C:\\xampp\\apache\\conf\\httpd.conf
。 Scrolled down to the Supplemental configuration section at the end, and located the following section (around line 500), Removed the #
from the beginning of the second line so the section now looks like this:向下滚动到最后的Supplemental configuration部分,找到以下部分(大约第 500 行),从第二行的开头删除#
,因此该部分现在看起来像这样:
#Virtual hosts
Include conf/extra/httpd-vhosts.conf
Step 4) Restarted XAMPP and now run this in my browser :第 4 步)重新启动 XAMPP,现在在我的浏览器中运行它:
www.test.com
But now I get this as result:但现在我得到了这个结果:
ERROR The requested URL could not be retrieved错误 无法检索请求的 URL
The following error was encountered while trying to retrieve the URL: http://test.com/
Unable to determine IP address from hostname test.com
The DNS server returned:
Name Error: The domain name does not exist.
This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.
Your cache administrator is root.
So how to solve this and ran the Laravel project on a virtual hostname?那么如何解决这个问题并在虚拟主机名上运行 Laravel 项目呢?
There is a problem in your step 2 change the ServerName to test.com你的第2步有问题把ServerName改成test.com
These two links will help you more这两个链接将帮助您更多
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.