简体   繁体   English

仅获取/ var / www / html文件夹中的文件列表

[英]Only getting list of files on /var/www/html folder

I'm trying to host my laravel app on an ubuntu machine I added the laravel app to the /var/www/html folder which is root directory for my domain on apache conf file. 我试图将laravel应用程序托管在ubuntu机器上,我将laravel应用程序添加到/ var / www / html文件夹,该文件夹是apache conf文件中我的域的根目录。 But when I access my domain, I only get the list of files in /var/www/html folder. 但是,当我访问自己的域时,只能得到/ var / www / html文件夹中的文件列表。 When I insert a index.html file for test, it works perfectly when I access the domain. 当我插入index.html文件进行测试时,当我访问域时,它可以完美地工作。 What can be happening? 会发生什么事?

Your apache needs to be configured to recognize index.php as well as index.html. 您的Apache需要配置为可以识别index.php和index.html。 This is done by setting the directoryindex in the httpd.conf file. 这是通过在httpd.conf文件中设置directoryindex来完成的。

Laravel is served out of index.php inside the public folder. Laravel不在public文件夹内的index.php

You are getting your list of files because your domain is pointing to var/www/html which contains the root of your Laravel application and not the public directory which contains index.php . 您正在获取文件列表,因为您的域指向的是var/www/html ,它包含Laravel应用程序的根目录,而不是包含index.phppublic目录。

If you go to www.yourdomain.com/public you will find your application served correctly if your apache is set up to recognize index.php which it should be. 如果您访问www.yourdomain.com/public ,并且您的Apache设置为可以识别index.php ,那么您会发现应用程序可以正确运行。

To fix this up so you don't need to use public inside the URL you can just edit /etc/apache2/sites-available to point your directory to /var/www/html/public and then you will be able to access it through www.yourdomain.com . 要解决此问题,这样您就不需要在URL内使用public,只需编辑/etc/apache2/sites-available即可将目录指向/var/www/html/public ,然后就可以访问它了通过www.yourdomain.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM