Skip to content

Instantly share code, notes, and snippets.

@cfxd
Last active June 2, 2022 11:53
Show Gist options
  • Save cfxd/8a12db41571b593f0822 to your computer and use it in GitHub Desktop.
Save cfxd/8a12db41571b593f0822 to your computer and use it in GitHub Desktop.
Deploy WordPress (Bedrock) with Capistrano to a Shared Host (Bluehost). See http://cfxdesign.com/deploy-wordpress-with-capistrano-on-bluehost/
RewriteEngine on
#change dev.example.com to your domain name
RewriteCond %{HTTP_HOST} ^(www.)?dev.example.com$
RewriteCond %{REQUEST_URI} !^/current/web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /current/web/$1
#change dev.example.com to your domain name
RewriteCond %{HTTP_HOST} ^(www.)?dev.example.com$
RewriteRule ^(/)?$ current/web/index.php [L]
set :application, 'dev.example.com'
set :repo_url, '[email protected]:username/repo.git'
set :branch, :master
set :deploy_to, -> { "/home2/whatever/public_html/#{fetch(:application)}" }
set :log_level, :debug
set :linked_files, %w{.env web/.htaccess}
set :linked_dirs, %w{web/app/uploads}
set :tmp_dir, "/home2/whatever/capistrano_tmp"
SSHKit.config.command_map[:bash] = "/usr/bin/bash"
SSHKit.config.command_map[:composer] = "php-cli /home2/whatever/composer.phar"
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :service, :nginx, :reload
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment