虚拟主机无法使用XAMPP服务器创建 [英] Virtual Host cannot create with XAMPP server
问题描述
我在httpd-vhost.conf文件中添加了以下代码.
I add the following codes in httpd-vhost.conf file.
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/mmcast"
ServerName mmcast.dev
<Directory "C:/xampp/htdocs/mmcast">
AllowOverride All
Require all granted
</Directory>
尽管我可以在XAMPP中运行Apache和MySQL,但不能调用我的虚拟主机.
在浏览器中调用mmcast.dev时出现无法连接"错误.
我是否需要将<VirtualHost *:80>
更改为81?因为我更改了httpd文件中的监听81 .但是,我尝试将80更改为81,但仍然无法正常工作.
Although I can run the Apache and MySQL in XAMPP but I cannot call my vhost.
I got "Unable to connect" error in when I call mmcast.dev in browser.
Do I need to change <VirtualHost *:80>
into 81 ? Because I change Listen 81 in httpd file. But, I tried to change 80 to 81 but it still does not work.
在 httpd.conf 文件中,我进行了这样的更改,但它不起作用.
In httpd.conf file, I change like this but it does not work.
<Directory />
AllowOverride all
Require all granted
</Directory>
在主机文件中
127.0.0.1 mmcast.dev
仅http://localhost:81/mmcast/
有效.有人可以帮我吗?
Only http://localhost:81/mmcast/
works. Can anyone help me please?
推荐答案
首先确认您在主机文件中有一个条目-
Very first confirn you have an entry in hosts file -
127.0.0.1 mmcast.dev
第二,检查httpd.conf
文件-有多个< directory
标记,必要时将所有Require all granted
Second, check httpd.conf
file - there are multiple < directory
tag and if necessary make all Require all granted
第三,在httpd-vhost.conf
文件中写下面的行
Third, in httpd-vhost.conf
file write bellow lines
# you can put any port whatever you feel comfortable! I normally use 127.0.0.1:144 and counting for every project
Listen 127.0.0.1:81
<VirtualHost 127.0.0.1:81>
ServerName mmcast.dev
DocumentRoot "C:\xampp\htdocs\mmcast"
SetEnv APPLICATION_ENV "development"
<Directory "C:\xampp\htdocs\mmcast">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
第四,重新启动XAMPP服务器.并在浏览器https://127.0.0.1:81
这篇关于虚拟主机无法使用XAMPP服务器创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!