#nginx test config sudo service nginx configtest
#restart nginx sudo service nginx restart
#restart php-service sudo service php5-fpm restart
#get php.ini path php -i | grep php.ini
#search for text in all files sudo grep -ir 'search-term' *
#new website config sudo vi /etc/nginx/sites-available/[name].conf
cd /etc/nginx/sites-enabled/
sudo ln -s ../sites-available/[name].conf [name.conf]
#setup ssh-keys
##generate local key
ssh-keygen -t rsa
##copy to remote if ssh-copy-id is available
ssh-copy-id -i ~/.ssh/id_rsa user@server
##otherwise (ssh-copy-id not available)
scp /.ssh/id_rsa.pub user@server:/.ssh/authorized_keys
#rsync options -a (archive, preserve timestamps etc) -r (recursive, include folders) -v (verbose, extra output) -z (compress) -e (use ssh for security) ##rsync example rsync -arvz -e 'ssh' user@server:~/remote/path/to/files/ /local/path/to/files ##extra options for magento backups --exclude 'var/session' --exclude 'var/locks' --exclude 'var/cache' --exclude 'media/catalog/product/cache'
--delete-excluded
--delete-excluded: In addition to deleting the files on the receiving side that are not on the sending side, this tells rsync to also delete any files on the receiving side that are excluded
#change ownership of all files and folders in current directory sudo chown -R www-data:www-data . #change permissions of all files and folders in current directory sudo chmod -R 770 .
#create a new mysql database mysql -u root -p'[root_password]'
create database [db_name];
grant all privileges on [db_name].* to [db_user]@localhost identified by 'db_password';
exit;
#mysql dump db mysqldump -u[db_user] -p[db_password] db_name > db-backup.sql
#mysql import database mysql -p[db_password] -u[db_user] db_name < /path/to/db-backup.sql
#setup git user on server git config --global user.name "Fistname Lastname"
git config --global user.email [email protected]
#flush memcache telnet localhost 11211
flush_all
quit
#create cronjob for other user (in this case www-data) sudo crontab -u www-data -e
#find current Magento version (from root folder) php -r "include 'app/Mage.php'; echo Mage::getVersion(); "
#compress all png's in subfolders of current directory find . -type f -name "*.png" -exec optipng -o7 {} ;
#compress all jpg's in subfolders of current directory find . -type f -name "*.jpg" -exec jpegoptim --strip-all {} ;
#cronjob to compress jpg's and turn into progressive that are -1 days old (runs at 5 in the night) 0 5 * * * find ~/httpdocs/public/media/ -mtime -1 -iname *.jpg -exec jpegoptim --max=80 --strip-all --all-progressive -p {} ;
#clear DNS cache on latest OSX sudo killall -HUP mDNSResponder