如何在webmin/virtualmin虚拟主机上安装laravel网站?首先按照常规在webmin先创建好网站。
然后ssh进入该网站的home目录
- ssh进入该网站的home目录
- 切换成该网站的用户,从git下载最新的laravel程序。或直接ftp上传
- -sh-4.1$ cd homes/
-sh-4.1$ git clone https://[email protected]/ctohome/hosting-comparation.git
Initialized empty Git repository in /home/hosting/homes/hosting-comparation/.git/
Password:
remote: Counting objects: 214, done.
remote: Compressing objects: 100% (166/166), done.
remote: Total 214 (delta 69), reused 147 (delta 31)
Receiving objects: 100% (214/214), 269.60 KiB | 151 KiB/s, done.
Resolving deltas: 100% (69/69), done.
- ssh回到网站主目录了,修改public_html根目录指向到laravel项目的public
-sh-4.1$ mv public_html public_html_old
-sh-4.1$ ln -s ./homes/hosting-comparation/public ./public_html
- 这个时候,访问网站,会有缺少vendor文件的错误:
PHP Fatal error: require(): Failed opening required '/home/hosting/homes/hosting-comparation/public/../vendor/autoload.php' (include_path='.:/opt/rh/rh-php70/root/usr/share/pear:/opt/rh/rh-php70/root/usr/share/php') in /home/hosting/homes/hosting-comparation/public/index.php on line 24
- 进入laravel项目的主目录,重新安装需要的vendor等库
-sh-4.1$ pwd
/home/hosting/homes/hosting-comparation
-sh-4.1$ composer update --no-scripts
Loading composer repositories with package information
Updating dependencies (including require-dev)
这个步骤需要几分钟时间
- 设置.env文件,设置APP_KEY ,设置 APP_DEBUG=false 如果暂时先打开debug方便调试,正式运营后需要关闭,不然会暴露各种密码
- 导入数据库文件,设置好.env的数据库用户名密码,就可以开始访问网站试一试了。
- 如果git有修改,需要pull最新数据:
-sh-4.1$ git pull
Password:
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From https://bitbucket.org/10168/hosting-comparation
ec475f0..9768a89 master -> origin/master
Updating ec475f0..9768a89
Fast-forward
routes/web.php | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
-