在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):petehouston/laravel-deploy-on-shared-hosting开源软件地址(OpenSource Url):https://github.com/petehouston/laravel-deploy-on-shared-hosting开源编程语言(OpenSource Language):开源软件介绍(OpenSource Introduction):How to deploy Laravel applications on shared hostingThe simple guide to deploy Laravel and Lumen application on shared hosting. For a quick version of the guide (many of you might already read about it), read my post on medium, "The simple guide to deploy Laravel 5 application on shared hosting" RequirementsBefore trying to deploy a Laravel application on a shared hosting, you need to make sure that the hosting services provide a fit requirement to Laravel. Basically, following items are required for Laravel 5.2:
Well, it also depends on the Laravel version you want to try to install, checkout the appropriate version of Laravel server requirements documentation. Next, you need to have the SSH access permission for your hosting account; otherwise, none of these will work. Besides PHP and those required extensions, you might need some utilities to make deployment much easier. I guess that's enough for good. Please refer to below sections to learn more about deployment. InstructionLet's get started by understanding how we should organize the Laravel application structure. At first, you will have this or similar directories and files in your account, .bash_history
.bash_logout
.bash_profile
.bashrc
.cache
.cpanel
.htpasswds
logs
mail
public_ftp
public_html
.ssh
tmp
etc
www -> public_html
... For the main account which tied with the main domain, the front-end code should stay in Create a new directory to store all the code, name it $ mkdir projects
$ cd projects Alright, from here, just issue a git command to grab the code, $ git clone http://[GIT_SERVER]/awesome-app.git
$ cd awesome-app Next step is to make the $ mv public public_bak
$ ln -s ~/www public
$ cp -a public_bak/* public/
$ cp public_bak/.htaccess public/ Because we created the symbol link from - require __DIR__.’/../bootstrap/autoload.php’;
+ require __DIR__.'/../projects/awesome-app/bootstrap/autoload.php';
- $app = require_once __DIR__.’/../bootstrap/app.php’;
+ $app = require_once __DIR__.'/../projects/awesome-app/bootstrap/app.php'; The updated file should be: require __DIR__.'/../projects/awesome-app/bootstrap/autoload.php';
$app = require_once __DIR__.'/../projects/awesome-app/bootstrap/app.php'; The hard part is done, the rest is to do some basic Laravel setup. Allow write permission to $ chmod -R o+w storage Edit your Lastly, update the required packages for Laravel project using composer and add some necessary caches, $ php composer install
$ php composer dumpautoload -o
$ php artisan config:cache
$ php artisan route:cache Congratulation! You've successfully set up a Laravel application on a shared hosting service. FAQs
Just contact your hosting support, they will need to confirm your identity and will permit your SSH access in no time.
alias git="/usr/local/cpanel/3rdparty/bin/git"
You can use FTP or SCP command to upload $ wget https://getcomposer.org/composer.phar
or
$ curl -sS https://getcomposer.org/installer | php — –filename=composer
Well, Laravel and Lumen are like twins, so it applies the same with Lumen.
You need to provide a proper PHP configuration to run $ php -c php.ini composer [COMMAND]
You can copy the default PHP configuration file $ php -i | grep "php.ini" List of service providers tested and workedThe following shared hosting service providers have been tested and worked perfectly 100%. Works on GeekStorage shared plan but I had to enable PHP 5.6 via
If you found any hosting providers that works, please tell me, I will update the list for others to know about them, too. Still trouble?If you still fail to deploy Laravel applications after following all above steps. Provide me your issue in details, I will help you out. Contribution GuideFree free to fork the project and submit a pull request. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论