我正在使用deploy bot在服务器上部署laravel项目。 在请求请求后,我在服务器上运行以下这些命令
$previous_month_start = Carbon::now()->subMonth()->startOfMonth()->format('x'); $previous_month_end = Carbon::now()->subMonth()->endOfMonth()->format('x');
chmod -R 777 $RELEASE/storage
composer install --no-progress --optimize-autoloader
php artisan config:cache php artisan migrate
php artisan passport:install
然后我的项目运行顺利,但是问题是因为我必须运行 php artisan Passport:始终安装,然后再次生成密钥,然后当前用户必须注销才能继续。 如果我从以下命令中删除php artisanpassport:install,则在找到时会生成错误密钥
Composer.json:
php artisan passport:client --personal
如果php artisan install:passport不存在,则日志文件错误:
{ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.1.3", "barryvdh/laravel-cors": "^0.11.3", "bosnadev/repositories": " 0.*", "fideloper/proxy": "^4.0", "laravel/framework": "5.8.*", "laravel/passport": "^7.2", "laravel/tinker": "^1.0", "laravelcollective/html": "^5.7", "orangehill/iseed": "^2.6", "spatie/laravel-menu": "^3.3", "spatie/laravel-permission": "^2.32" }, "require-dev": { "beyondcode/laravel-dump-server": "^1.0", "filp/whoops": "^2.0", "fzaninotto/faker": "^1.4", "mockery/mockery": "^1.0", "nunomaduro/collision": "^2.0", "phpunit/phpunit": "^7.0", "user11001/eloquent-model-generator": "^2.0", "xethron/migrations-generator": "^2.0" }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "extra": { "laravel": { "dont-discover": [] } }, "autoload": { "psr-4": { "App\\": "app/" }, "classmap": [ "database/seeds", "database/factories" ] }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "minimum-stability": "dev", "prefer-stable": true, "scripts": { "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] } }
local.ERROR: Key path "/public_html/releases/1556096621/storage/oauth-private.key" does not exist or is not readable {"userId":1,"exception":"[object]
(LogicException(code: 0): Key path \"file:///folderName/public_html/releases/1556096621/storage/oauth-private.key\" does not exist or is not readable at
/home/folderName/public_html/shared/vendor/league/oauth2-server/src/CryptKey.php:48)
答案 0 :(得分:1)
passport:install命令。此命令将创建加密密钥 需要生成安全的访问令牌。另外,该命令将 创建“个人访问权限”和“密码授予”客户端 用于生成访问令牌:
Passport通过.env中的APP_KEY生成这些密钥。在作曲家安装后,此密钥已更改,因此护照生成的现有密钥将不起作用:local.ERROR: Key path "/public_html/releases/1556096621/storage/oauth-private.key" does not exist or is not readable
。因为它是使用旧的APP_KEY生成的