search

Home  >  Q&A  >  body text

php - laravel public related issues

I have installed laravel once before, and I can open the welcome page by directly accessing public under laravel.
This time I copied one from someone else, and after accessing public, the files under public are directly displayed, as shown below. What's going on? (Newbie, please explain in detail, thank you very much)

習慣沉默習慣沉默2837 days ago683

reply all(4)I'll reply

  • 巴扎黑

    巴扎黑2017-06-12 09:22:08

    In case of nginx configuration problem, in your case, you should check whether your nginx server module index has index.php, and then check whether nginx is configured with php-fpm to process PHP files

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-12 09:22:08

    Detailed reference:

    
    Pretty URLs
    
    Apache
    
    The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.
    
    If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:
    
    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    https://laravel.com/docs/5.1

    reply
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-12 09:22:08

    First, check whether you are accessing through the HTTP protocol. This situation usually occurs when accessing through the file: protocol.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-12 09:22:08

    Thank you for your answers. It is indeed a problem on the server side. Gundy's answer is Nginx's processing method. Mine is an apache server. The following paragraph is the result of Baidu.
    Under the Apache directory, there is a conf directory. Open the "httpd" in it. .conf" file, find the DirectoryIndex section. Change it to DirectoryIndex index.php index.Html index.html In this way, the default homepage of your website directory is index.php. If there is no index.php, the system will automatically look for index.html , html is used as the default homepage.

    reply
    0
  • Cancelreply