简体   繁体   中英

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. But when I access my domain, I only get the list of files in /var/www/html folder. When I insert a index.html file for test, it works perfectly when I access the domain. What can be happening?

Your apache needs to be configured to recognize index.php as well as index.html. This is done by setting the directoryindex in the httpd.conf file.

Laravel is served out of index.php inside the public folder.

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 .

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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