安装 Laravel 后 XAMPP localhost 返回对象未找到
经过一番折腾后,我让 laravel 与 XAMPP 一起工作.但是,我现在似乎无法通过 localhost 访问 htdocs 文件夹中的目录.尝试访问文件会返回 Object not found!
以及 在此服务器上未找到请求的 URL.如果您手动输入了 URL,请检查您的拼写并重试.
After much faffing about I got laravel to work with XAMPP. However, I can't seem to access directories in the htdocs folder via localhost now. Attempt to access a file returns Object not found!
along with The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
我为使 laravel 工作所做的更改现在看起来很模糊.我记得做的唯一一件事是编辑 hosts
文件,通过在 hosts 文件中添加 127.0.0.1 laravel.dev
来启用虚拟主机(使用 mac btw).我还在 httpd-vhost.conf 文件中添加了一个虚拟主机.
The changes I made to get laravel working seems like a blur now. The only thing I remember doing is editing the hosts
file to enable the virtual host to work by adding 127.0.0.1 laravel.dev
in the hosts file (using a mac btw). I also added a virtual host to the httpd-vhost.conf file.
我确实撤消了上述更改,但没有任何影响.
I did undo the above changes but it didn't make a difference.
你有什么想法吗?
谢谢.
解惑只是想我会澄清我的经历.在安装 laravel 4 之前,我可以使用 localhost/someProjectName
访问我的所有项目,但现在它失败了.
Dispelling Confusion
Just thought I'd clarify what my experience is. Before installing laravel 4 I could access all my projects with localhost/someProjectName
but now it fails.
我正在尝试确定是什么变化导致了这种行为.顺便说一句,我访问我的 laravel 项目没有问题(我的映射允许我通过 laravel.dev
访问它)
I'm trying to identify what change caused this behaviour. Btw, I have no problems accessing my laravel project (my mapping allows me access to it via laravel.dev
)
推荐答案
查看你的 /etc/httpd.conf
文件,看看你是否激活了虚拟主机.
Look into your /etc/httpd.conf
file and see if you have Virtual hosts activated.
如果是这样,请检查您的 etc/extra/httpd-vhosts.conf
文件.您可能已经设置了 VirtualHost.
If so, check your etc/extra/httpd-vhosts.conf
file. You might have set up a VirtualHost already.
我发现一旦你打开虚拟主机,XAMPP 需要一个默认的虚拟主机来保存你的基本 htdocs 文件
I have found that once you turn on Virtual Hosts, XAMPP needs a default VirtualHost for your basic htdocs files
尝试添加一个默认的 VirtualHost(在文件底部),如下所示:
Try adding a default VirtualHost (at the bottom of the file) like so:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/htdocs"
<Directory "/Applications/XAMPP/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>
相关文章