问题
I want to host a laravel project in a subdomain.. For that first First I create a subdomain name registraion.
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.
what's the problem of uploading the laravel project? Can anyone help me to find it out?
回答1:
Assuming you are using cPanel to create subdomain. Below are the general steps that are required to setup sub-domain for 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.
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.
Let us know if this helps you or not.
回答2:
Do as what @Samundra mentioned. If you have confusion this is the place where you need to put public_html/registration/public
in your cPanel -> Sub-Domain
回答3:
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.
so i created one .env and added
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
php artisan key:generate --show
Then I kept the key in the .env. Then Its done. Hope it may help someone
来源:https://stackoverflow.com/questions/39886926/how-to-upload-laravel-project-on-subdomain