Deploying web application in GoDaddy Linux Hosting

后端 未结 1 1051
轻奢々
轻奢々 2021-01-16 21:45

Good day,

I am trying to deploy a laravel application to godaddy linux hosting. I am kind of new to cloud servers and I am having problems referencing the public/in

1条回答
  •  被撕碎了的回忆
    2021-01-16 21:58

    I understand your situation. Do this

    Let's consider that the subject project called "website"

    originally "website" directory is something like this.

     - app
     - bootstrap
     - config 
     - database
     - public
     - ...
     - vendor
     - .env
     - artisan
     - composer.json
    

    Now this is what you need to do. group everything to a folder name "website" (your subject project all or call it something you want) but Except for the "public folder"

    You should have directory to look like this.

    - website
        - app
        - bootstrap
        - ...
        - .env
        - composer.json
    - public
    

    Now for the public folder, move everything outside and will look like this.

    - website
      - app
      - bootstrap
      - ...
      - .env
      - composer.json
    - index.php
    - .htaccess
    - (your assets css/js/images files)
    

    You're almost there, we should just need to edit the index.php from

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

    to

    require __DIR__.'/website/bootstrap/autoload.php';  //where website is the new foldername
    

    and

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

    to

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

    This should work now. and no need to access via "/public" folder in order to run the website in goDaddy or any sharedhosting in cpanel.

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