【发布时间】:2021-10-03 20:17:26
【问题描述】:
我想在 XAMPP 上使用虚拟主机加载我的 Laravel 5.8 项目。所以这就是我所做的:
我打开了C:\Windows\System32\drivers\etc\hosts 并放了这个:
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 local.nanoclub.ir
然后在C:\xampp\apache\conf\extra\httpd-vhosts.conf,我添加了这个:
<VirtualHost local.nanoclub.ir:80>
DocumentRoot "C:/xampp/htdocs/badges/public"
ServerName local.nanoclub.ir
ServerAlias *.local.nanoclub.ir
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/badges/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
并将其添加到我的项目中,公开.htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
但是现在当我想在浏览器上运行 local.nanoclub.ir 时,我得到了这个:
那么这里出了什么问题?我以前可以正确访问此local.nanoclub.ir,但现在它会加载此屏幕。
如何解决这个问题?
【问题讨论】:
-
是
<VirtualHost *:80>,修改后重启
标签: php laravel apache xampp virtualhost