虚拟主机无法使用 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 文件中更改了 Listen 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>
在 hosts 文件中,
127.0.0.1 mmcast.dev
只有 http://localhost:81/mmcast/
有效.谁能帮帮我?
Only http://localhost:81/mmcast/
works. Can anyone help me please?
推荐答案
首先确认您在 hosts 文件中有一个条目 -
Very first confirn you have an entry in hosts file -
127.0.0.1 mmcast.dev
其次,检查httpd.conf
文件——有多个目录
标签,如有必要,使所有要求所有授予
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:xampphtdocsmmcast"
SetEnv APPLICATION_ENV "development"
<Directory "C:xampphtdocsmmcast">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
第四,重启 XAMPP 服务器.并在浏览器中尝试 https://127.0.0.1:81
Fourthly, RESTART XAMPP Server. and try in browser https://127.0.0.1:81
这篇关于虚拟主机无法使用 XAMPP 服务器创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!