.env 上传后无软链接、用户为 root 问题

我是按照教程来的,先在homestead虚拟机~/deploy-laravel-shop/内运行scp root@ip_addr:/var/www/laravel-shop/.env .
file
然后编辑 deploy.php

<?php
namespace Deployer;

require 'recipe/laravel.php';

// Project repository
set('repository', 'https://github.com/captainwong/shop.git');

// Shared files/dirs between deploys
add('shared_files', []);
add('shared_dirs', []);

// Writable dirs by web server
set('writable_dirs', []);

// Hosts

host('ip_addr')
    ->user('root')
    ->identityFile('~/.ssh/laravel-shop-aliyun.pem')
    ->become('www-data')
    ->set('deploy_path', '/var/www/laravel-shop-deployer');

// Tasks
desc('Upload .env file');
task('env:upload', function() {
    upload('.env', '{{release_path}}/.env');
});
after('deploy:shared', 'env:upload');

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

// Migrate database before symlink new release.
before('deploy:symlink', 'artisan:migrate');

执行dep deploy也成功了,阿里云那边看/var/www/laravel-shop-deployer/shared,也有了.env文件,用户是www-data
file
*嗯,这里有异常,.env文件大小是0

但是current内的.env文件永远是属于root的,删除后重新执行dep deploy也一样,都到了releases/4了:
file

怎么破啊

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
leo
最佳答案

.env 文件是上传到 releases 目录下的,不在 shared 目录下(下一节的截图有误),.env 文件所属用户是 root 对站点运行没有影响。

5年前 评论
讨论数量: 2
leo

.env 文件是上传到 releases 目录下的,不在 shared 目录下(下一节的截图有误),.env 文件所属用户是 root 对站点运行没有影响。

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!