laravel 如何在子域上上传laravel项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39886926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to upload laravel project on subdomain?
提问by Hola
I want to host a laravel project in a subdomain.. For that first First I create a subdomain name registraion.
我想在子域中托管一个 Laravel 项目。首先,我创建一个子域名注册。
And inside the publicm_html/registraion i upload the project file.
But when I see the project on url I saw only files not the project I stored.
在 publicm_html/registraion 中,我上传了项目文件。
但是当我在 url 上看到项目时,我只看到了文件,而不是我存储的项目。
what's the problem of uploading the laravel project? Can anyone help me to find it out?
上传laravel项目有什么问题?谁能帮我找出来?
采纳答案by Samundra
Assuming you are using cPanel to create subdomain. Below are the general steps that are required to setup sub-domain for laravel-project.
假设您使用 cPanel 创建子域。以下是为 laravel-project 设置子域所需的一般步骤。
- Create your sub-domain
- Upload your laravel project to the sub-domain home directory.
- After you have uploaded all the files. Update your sub-domain document-root to point to
public_html/registration/public/
folder, you can do this from sub-domain manager inside cPanel see.
- 创建您的子域
- 将您的 Laravel 项目上传到子域主目录。
- 上传完所有文件后。更新您的子域文档根目录以指向
public_html/registration/public/
文件夹,您可以从 cPanel 中的子域管理器执行此操作,请参阅。
After following 1-3 steps you should see your laravel project. However you also need to setup proper file permissions on laravel's bootstrap
, storage
folder to get it up and running.
按照 1-3 个步骤之后,您应该会看到您的 Laravel 项目。但是,您还需要在 laravel 的bootstrap
,storage
文件夹上设置适当的文件权限以使其启动并运行。
Let us know if this helps you or not.
让我们知道这是否对您有帮助。
回答by Mahfuzul Alam
回答by S Debasish Nayak
In my case i tried each and every solution available. But when I checked the log I found one error:
就我而言,我尝试了所有可用的解决方案。但是当我检查日志时,我发现了一个错误:
production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified. at /home/******/public_html/**subdomain name*/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:44)
[stacktrace]
Then I searched for .env file in my project structure.(Check the hidden files list). In my project .env was not there by default only .env.example file was there.
然后我在我的项目结构中搜索 .env 文件。(检查隐藏文件列表)。在我的项目中,默认情况下 .env 不存在,只有 .env.example 文件存在。
so i created one .env and added
所以我创建了一个 .env 并添加了
APP_NAME=Laravel
APP_ENV=local
APP_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=xxxxxxxxxxxxxxxxxxx
DB_USERNAME=xxxxxxxxxxxxxxxxxxx
DB_PASSWORD=xxxxxxxxxxxxxxxxxxx
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
I have generated one APP_KEY. For this I used
我已经生成了一个 APP_KEY。为此,我使用了
php artisan key:generate --show
Then I kept the key in the .env. Then Its done. Hope it may help someone
然后我将密钥保存在 .env 中。然后它完成了。希望它可以帮助某人