Skip to content

Instantly share code, notes, and snippets.

@ashikawa
Last active December 20, 2015 20:29
Show Gist options
  • Save ashikawa/6191108 to your computer and use it in GitHub Desktop.
Save ashikawa/6191108 to your computer and use it in GitHub Desktop.
Apache で自動デプロイ
#! /bin/sh
echo -ne "Content-Type: text/plain; charset=UTF-8\r\n\r\n"
cd /var/www/$PROJECTS
git pull
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/$PROJECTS/public
<Directory "/var/www/$PROJECTS/public">
Options -Indexes FollowSymLinks
order deny,allow
deny from ALL
allow from ALL
AllowOverride All
</Directory>
ScriptAlias /scripts/ "/var/www/$PROJECTS/scripts/"
<Directory "/var/www/$PROJECTS/scripts/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

ディレクトリ構成

  • /var/www/$PROJECTS/
    • .git/
    • public/
      • html など
    • scripts/
      • gitpull.sh

chown -R apache:apache - /var/www/$PROJECTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment