Skip to content

Instantly share code, notes, and snippets.

@axelf
axelf / manual.md
Created January 30, 2017 12:17 — forked from te-online/git-deployment-manual.md
Git Deployment strategy set-up manual 👀 🚀

Steps

  1. Init local git repository (remember to create .gitginore with wp-config.php before staging anything)
  2. Configure SSH-key access to server with git [https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/, https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Transfer_Client_Key_to_Host]
  3. Init a bare repo on the server git init && git config core.bare true
  4. Create a new post-receive hook with nano .git/hooks/post-receive (content see below!)
  5. Execute chmod 755 post-receive on the script
  6. Add remote to local repository git remote add staging user-name@your-domain.com:www/your-website
  7. Try pushing git push staging master
  8. Check if everything works as expected.
  9. Add a .htaccess to the .git directory with content: deny from all
<?php
/**
* GitHub webhook handler template.
*
* @see https://developer.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@axelf
axelf / htaccess.expires.headers
Created June 14, 2021 13:58 — forked from solancer/htaccess.expires.headers
htaccess expires headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"