git workflow ubuntu www

on ubuntu:

install git

create repo (home git repos)

make .git repo and sub files’ group and owner -> git

in repo hook folder, create “post-receive” and paste this:

git –work-tree=/var/www/[cloned-git-folder] –git-dir=/home/git/repos/[repo-name].git checkout -f

(above work-tree and git-dir commands starts with two – sign)

clone git in var/www

make cloned www folder group -> www-data, owner -> git

connect ssh repo with git user because remote git repo post-receive file’s owner and group is git user

in usr/local/bin create command file like “pull-reponame”

paste this:

cd /var/www/[cloned-repo-folder]
git stash && git pull

you can make owner any user and group git

add execute permission to git group

add any user to git group to allow running this command shortcut

bootstrap 3 latest download & grunt ops

Install C

bower install bootstrap
npm install bootstrap@3
composer require twbs/bootstrap

  • install npm
  • npm install -g grunt-cli.
  • cd /bootstrap root folder
  • npm install

Available Grunt commands

grunt dist (Just compile CSS and JavaScript)

Regenerates the /dist/ directory with compiled and minified CSS and JavaScript files. As a Bootstrap user, this is normally the command you want.

grunt watch (Watch)

Watches the Less source files and automatically recompiles them to CSS whenever you save a change.

grunt test (Run tests)

Runs JSHint and runs the QUnit tests headlessly in PhantomJS.

grunt docs (Build & test the docs assets)

Builds and tests CSS, JavaScript, and other assets which are used when running the documentation locally via bundle exec jekyll serve.

grunt (Build absolutely everything and run tests)


ubuntu 14 apache ssl activate, create self signed certificate, configure virtual host

sudo a2enmod ssl
sudo service apache2 restart
sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/your_domain.key -out /etc/apache2/ssl/your_domain.crt
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:New York City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Your Company
Organizational Unit Name (eg, section) []:Department of Kittens
Common Name (e.g. server FQDN or YOUR name) []
Email Address []
sudo nano /etc/apache2/sites-available/default-ssl.conf
<IfModule mod_ssl.c>
  <VirtualHost _default_:443>

  <VirtualHost _default_:443>
	DocumentRoot /var/www/
	ErrorLog ${APACHE_LOG_DIR}/error_your_domain_com_ssl.log
	CustomLog ${APACHE_LOG_DIR}/access_your_domain_ssl.log common	
	SSLEngine on
	SSLCertificateFile /etc/apache2/ssl/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/apache.key
sudo a2ensite default-ssl.conf
sudo service apache2 restart
RewriteEngine on

RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

RewriteCond %{HTTPS} !on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php