简体   繁体   中英

How to deploy lumen framework on shared hosting (subdomain)

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.

您将需要将其与FileZilla一起移动到/var/www/html/foldername内的子文件夹中,并将配置设置为该目录,但是我不建议您在共享主机中设置微服务。

I not got any answer from stackoverflow, and doesn't one onswer my question in stackoverflow, so i try hard find own solution with manual upload my lumen application in my shared hosting.

just put your lumen application in outside public_html and put your index.php file to subdomain and edit index.php set route to your subdomain.

if anyone have problem like me and read this question, you can ask from this question, i will help you if i got notice from this page.

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

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