找到XAMPP安装目录,
F:\xampp\apache\conf\extra\httpd-vhosts.conf
添加一段配置
<VirtualHost *:端口>
ServerAdmin webmaster@你的域名
DocumentRoot "F:/xampp/htdocs/你的域名"
ServerName 你的域名
ServerAlias 你的域名
ErrorLog "logs/你的域名-error.log"
CustomLog "logs/你的域名-access.log" common
</VirtualHost>
注意:把网站放到 "F:/xampp/htdocs/你的域名" 下,之前放在"F:/xampp/htdocs/"下导到报错“找不到对象!”,一直找不到原因。后来在百度看到了
https://zhidao.baidu.com/question/1048485850522142779.html
因素其实不多的:
1 D:\xampp\apache\conf 在这个文件夹下 httpd.conf 这个配置文件你要确定没改过
其中的
ServerRoot "/xampp/apache"
还有监听的80端口也是很重要的
如果你之前装过SQL 服务器他会占用的你的80端口,可以修改文件里面的80改成 (例如81)
2 D:\xampp\apache\conf\extra 这里有个httpd.vhost文件也是一个重要的配置
<VirtualHost *:80>
Options None
DocumentRoot D:\xampp\htdocs 确定这个下面 有Index.php 才能找到
ServerName 你配置的虚拟域名
DirectoryIndex index.php index.html index.htm
<Directory />
AllowOverride All
Order deny,allow
Allow from all
</Directory>
<Directory "D:\xampp\htdocs\"> 确定这个下面 有Index.php 程序才能找到
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3,没有东西的话,试试在Localhost/你的控制器的名字
例如localhost/message
万分不行,重装,然后在htdocs文件夹下,先删掉所有,再把你的东西放进去
View Code