简体   繁体   English

如何在共享主机(子域)上部署lumen框架

[英]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. 我在本地主机上有项目,我需要有人可以帮助我将lumen框架部署到托管,我一直在谷歌搜索部署lumen,但我刚刚发现部署laravel,也许laravel和lumen是相同的框架,但我不知道如何将lumen框架部署到子域中的共享主机。

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. 但我刚遇到错误500。

oh, before i run i have been edit index.php to directing to lumenproject : 哦,在我运行之前,我已经将index.php编辑为定向到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. 我没有从stackoverflow那里得到任何答案,也没有在stackoverflow中回答我的问题,因此我尝试通过在共享主机中手动上载lumen应用程序来寻找自己的解决方案。

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. 只需将流明应用程序放在public_html外部,然后将index.php文件放到子域中,然后将index.php设置的路由设置到您的子域即可。

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 . 我假设您的共享托管文件管理器具有/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 在public_html或htdocs之外创建一个文件夹,该文件夹的名称取决于您,例如“ myfolder”,其结构类似于/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 解压缩后,在“ myfolder”中有一个名为“ public”的文件夹,将其中的内容移动到

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 移动完这些文件后,在/home/username/public_html/home/username/public_html/sub编辑index.php

  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" 不要忘记在“ myfolder”中的.env文件中编辑APP_URL

Example the APP_URL .env file 示例APP_URL .env文件

APP_URL=http://yourdomain.com or http://sub.yourdomain.com or http://yourdomain.com/sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM