我正在使用 Capifony 将我的 Symfony2 应用程序部署到我的服务器上,并且已经使用了几个月了。然而,今天当我部署到我的服务器时,我突然开始出现权限被拒绝错误!我以前从未有过这些,我没有更改任何服务器权限,事实上,我只部署了一个小时左右,这很好吗?!以下是错误示例:
** [out :: xx.xxx.xxx.xxx]
** [out :: xx.xxx.xxx.xxx] rm:
** [out :: xx.xxx.xxx.xxx] cannot remove `/var/www/vhosts/xyz.co.uk/releases/20130604203446/web/bundles/website/lib/frontend/img/blog/pop-2.jpg': Permission denied
** [out :: xx.xxx.xxx.xxx]
** [out :: xx.xxx.xxx.xxx] rm:
** [out :: xx.xxx.xxx.xxx] cannot remove `/var/www/vhosts/xyz.co.uk/releases/20130604203446/web/bundles/website/lib/frontend/img/awaitingimages.jpg': Permission denied
** [out :: xx.xxx.xxx.xxx]
** [out :: xx.xxx.xxx.xxx] rm:
** [out :: xx.xxx.xxx.xxx] cannot remove `/var/www/vhosts/xyz.co.uk/releases/20130604203446/web/bundles/website/lib/frontend/img/ratingsprite.gif': Permission denied
** [out :: xx.xxx.xxx.xxx]
command finished in 561ms
failed: "sh -c 'if [ `readlink /var/www/vhosts/xyz.co.uk/current` != /var/www/vhosts/xyz.co.uk/releases/20130604203446 ]; then rm -rf /var/www/vhosts/xyz.co.uk/releases/20130604203446; fi'" on xx.xxx.xxx.xxx
我得到了很多这些错误。我正在使用与往常一样的部署用户。我想知道这是否与作曲家更新有关。这是我的 composer.json 文件:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.2.*",
"symfony/monolog-bundle": "2.2.*",
"sensio/distribution-bundle": "2.2.*",
"sensio/framework-extra-bundle": "2.2.*",
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"egeloen/ckeditor-bundle": "2.*",
"knplabs/knp-menu-bundle": "1.1.*",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/data-fixtures": "dev-master",
"egeloen/google-map-bundle": "*",
"willdurand/geocoder": "*",
"kriswallsmith/buzz": "*",
"phpunit/phpunit": "3.7.*",
"phpunit/php-invoker": "*",
"doctrine/doctrine-migrations-bundle": "dev-master",
"liuggio/rackspace-cloud-files-streamwrapper": ">=2.1",
"liuggio/rackspace-cloud-files-bundle": ">=2.1",
"avalanche123/imagine-bundle": "v2.1"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin",
"bin-dir": "/usr/local/bin/"
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "symlink",
"branch-alias": {
"dev-master": "2.2-dev"
}
}
}
这是我的 deploy.rb 脚本:
set :stage_dir, 'app/config/deploy' # needed for Symfony2 only
set :stages, %w(production staging development)
require 'capistrano/ext/multistage'
set :application, "xyz.co.uk"
set :user, "deployer" # The server's user for deploys
set :normalize_asset_timestamps, false
set :repository, "git@github.xyz/xyz.co.uk.git"
set :scm, :git
set :keep_releases, 5
after "deploy:update", "deploy:cleanup"
set :use_sudo, true
set :web_path, "web"
set :shared_files, ["app/config/parameters.yml", "web/.htaccess"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]
set :use_composer, true
set :update_vendors, true
set :dump_assetic_assets, true
set :deploy_via, :remote_cache
set :writable_dirs, ["app/cache", "app/logs", "web/uploads"]
set :webserver_user, "www-data"
set :permission_method, :acl
set :use_set_permissions, true
logger.level = Logger::MAX_LEVEL
我的 production.rb 脚本:
server 'xx.xxx.xxx.xxx', :app, :web, :primary => true
ssh_options[:port] = xxxx
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :deploy_to, "/var/www/vhosts/xyz.co.uk/"
set :symfony_env_prod, "prod"
set :branch, "master"
after 'deploy:finalize_update', 'symfony:project:clear_controllers'