我在httpd-vhost.conf文件中添加下面的代码。
<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/mmcast" ServerName mmcast.dev <Directory "C:/xampp/htdocs/mmcast"> AllowOverride All Require all granted </Directory>
尽pipe我可以在XAMPP中运行Apache和MySQL,但我无法调用我的虚拟主机。
当我在浏览器中调用mmcast.dev时,出现“无法连接”错误。
我是否需要将<VirtualHost *:80>
更改为81? 因为我在httpd文件中改变了Listen 81 。 但是,我试图改变80至81,但仍然无法正常工作。
在httpd.conf文件中,我改变这个,但是不起作用。
<Directory /> AllowOverride all Require all granted </Directory>
在hosts文件中,
127.0.0.1 mmcast.dev
只有http://localhost:81/mmcast/
works。 任何人都可以帮我吗?
首先确认你有一个在主机文件中的条目 –
127.0.0.1 mmcast.dev
其次,检查httpd.conf
文件 – 有多个< directory
标记,如有必要,使所有Require all granted
三,在httpd-vhost.conf
文件中写下行
# you can put any port whatever you feel comfortable! I normally use 127.0.0.1:144 and counting for every project listn 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>
第四, RESTART XAMPP服务器 。 并在浏览器https://127.0.0.1:81
尝试