Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy lumen framework on shared hosting (subdomain)

Tags:

php

hosting

lumen

I have project on localhost and I Need someone can help me to deploy lumen framework to hosting, i have been search in google for deploy lumen but i just found deploy laravel, maybe laravel and lumen is the same framework but i don't know how to deploy the lumen framework to my shared hosting in subdomain.

I have be been upload to :

/home/usernamecpanel/lumen 

and public folder i put to my subdomain like

/home/usernamecpanel/public_html/subdomain/index.php 
/home/usernamecpanel/public_html/subdomain/.htaccess

but i just got error 500.

oh, before i run i have been edit index.php to directing to lumenproject :

$app = require __DIR__.'/../../lumen/bootstrap/app.php';

I really confuse and i have been search in few day but cannot found the solution, i think someone can help me.

thank you.

like image 403
Hengky ST Avatar asked Apr 11 '19 09:04

Hengky ST


1 Answers

Thanks for reviewing my edit

How to Fix it?

  1. Zipping your Lumen Project
  2. Go to your shared hosting file manager
  3. I assume your shared hosting file manager have this directory structure like /home/username/public_html.
  4. Create a folder outside public_html or htdocs, the folder name is up to you, example "myfolder" the structure looks like /home/username/myfolder

  5. Upload your project to the new folder you have been created and unzip.

  6. After unzip, inside the "myfolder" there is a folder named "public", move the contents inside to

For Main Domain

/home/username/public_html

For Subdomain or Subfolder

/home/username/public_html/sub

  1. After moving those files, edit the index.php inside /home/username/public_html or /home/username/public_html/sub

  2. Inside the file you see this code

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

change the code to

For Main Domain

$app = require __DIR__.'/../myfolder/bootstrap/app.php';

For Sub Domain/Subfolder

$app = require __DIR__.'/../../myfolder/bootstrap/app.php';

Don't forget to edit the APP_URL in .env file inside "myfolder"

Example the APP_URL .env file

APP_URL=http://yourdomain.com or http://sub.yourdomain.com or http://yourdomain.com/sub
like image 194
Thomas Jeriko Avatar answered Nov 15 '22 04:11

Thomas Jeriko