sh 设置laravel5项目以部署到共享主机提供程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 设置laravel5项目以部署到共享主机提供程序相关的知识,希望对你有一定的参考价值。

#!/bin/bash

myproject='myproject'
mywww='public_html'

# initialize project
composer create-project laravel/laravel $myproject --prefer-dist
cd $myproject

# fix paths to public
for f in server.php storage/framework/compiled.php; do
    perl -pi -e "s|/public|/../${mywww}|" $f
done

# this regex needs to be executed every time the vendor code is updated
oldstr="\$this->basePath.DIRECTORY_SEPARATOR.'public'"
newstr="dirname(\$this->basePath).DIRECTORY_SEPARATOR.'${mywww}'"
sed -i '' "s|${oldstr}|${newstr}|" vendor/laravel/framework/src/Illuminate/Foundation/Application.php

# fix path to bootstrap
perl -pi -e "s|/bootstrap|/${myproject}/bootstrap|" public/index.php

# rename the public folder to match hosting providers web root
mv public $mywww

# create a directory for everything except the public directory
mkdir $myproject

# move stuff to app dir
mv {app,bootstrap,config,database,resources,storage,tests,vendor,artisan,.env*,*.js*,*.lock,*.php,*.xml,*.yml} $myproject

# use artisan to remove the compiled app
cd $myproject
php artisan clear-compiled

以上是关于sh 设置laravel5项目以部署到共享主机提供程序的主要内容,如果未能解决你的问题,请参考以下文章

如何将 Laravel 5.5 应用部署到 Godaddy cPanel 共享主机

Cpanel 共享主机中的 Laravel 5.5 错误 500

将 laravel 应用程序部署到共享主机并得到“未指定应用程序加密密钥”。错误

PHP笔记-虚拟空间(虚拟主机)上部署Laravel5.7

PHP笔记-虚拟空间(虚拟主机)上部署Laravel5.7

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