Laravel Application is not working after uploading to the server

前端 未结 4 1285
暗喜
暗喜 2020-12-04 02:46

My laravel Application was working perfect on the local server. But After I uploaded it to my server it is not working. The directory structure of my application is shown in

相关标签:
4条回答
  • 2020-12-04 03:04

    Try visiting http://127.0.0.1/Workshop/public_html

    There is no index.php or .htaccess in the Workshop folder. These would normally be inside public but looks like you have public_html instead

    0 讨论(0)
  • 2020-12-04 03:09

    If you are placing the Laravel app inside the public_html or inside a subfolder, you have to set some rules for the .htaccess. Please refer to this answer:

    https://stackoverflow.com/a/30497841/7801507

    If you want to install the web app on the root of the server, please place all the content of the application in the root directory and rename the public folder to the public_html or www or web, whatever is the public folder of your domain.

    0 讨论(0)
  • 2020-12-04 03:13

    Make sure you have correct web server configuration. You should point web server to a public directory and restart it.

    Also, make sure you've set correct permissions on a storage directory:

    chmod -R 775 storage
    

    And try to clear all cache:

    php artisan cache:clear
    php artisan route:clear
    php artisan config:clear
    php artisan view:clear
    php artisan clear-compiled
    
    0 讨论(0)
  • 2020-12-04 03:15

    I had trouble with this also. What you have to do is put the "public" folder in your "www" directory (or the appropriate public_html folder if you use a virtual machine). Next you have to put the WHOLE application in your var folder in a directory of your choice, lets call it "MySuperCoolFolder". Finally, you have to modify the index.php file. More specifically, these two lines.

    require __DIR__.'/../bootstrap/autoload.php';
    

    to

    require __DIR__.'/../MySuperCoolFolder/bootstrap/autoload.php'; 
    

    and

    $app = require_once __DIR__.'/../bootstrap/app.php';
    

    to

    $app = require_once __DIR__.'/../MySuperCoolFolder/bootstrap/app.php';
    

    And that should do it. If it does not work. Go to the documentation and use the .htaccess file they provide. That did the trick for me.

    Best of Luck!

    Reference: https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e#.nvinp0r3e

    0 讨论(0)
提交回复
热议问题