Do Not Think!!!

Posted
Filed under 글로 기록하기
$ defaults write com.apple.iPhoto PKFaceDetectionEnabled 0
Posted
Filed under 01010101
Host OS: Mac OS X
Guest OS: Ubuntu Server 14.04
VMware Fusion 7


Mac OS X

VMware CD/DVD connect to
/Applications/VMware Fusion.app/Contents/Library/isoimages/linux.iso

VMware Settings - Sharing - share folder


Ubuntu

$ sudo mkdir /mnt/cdrom
$ sudo mount /dev/cdrom /mnt/cdrom
$ cp /mnt/cdrom/VMwareTools-9.8.3-2075148.tar.gz .
$ tar zxvf VMwareTools-9.8.3-2075148.tar.gz
$ cd vmware-tools-distrib
$ sudo ./vmware-install.pl

reboot

$ sudo mkdir /mnt/hgfs
$ sudo mount -t vmhgfs .host:/sharedfolder /mnt/hgfs



Posted
Filed under 01010101
#!/bin/bash

function start() {
    echo "start Ubuntu on VMware"
    /Applications/VMware\ Fusion.app/Contents/Library/vmrun -T fusion start ~/Documents/Virtual\ Machines/Ubuntu\ 64-bit.vmwarevm/Ubuntu\ 64-bit.vmx nogui
}

function stop() {
    echo "stop Ubuntu on VMware"
    /Applications/VMware\ Fusion.app/Contents/Library/vmrun -T fusion stop ~/Documents/Virtual\ Machines/Ubuntu\ 64-bit.vmwarevm/Ubuntu\ 64-bit.vmx nogui
}


if [ "start" = "$1" ] ;
then
    start
elif [ "stop" = "$1" ] ;
then
    stop
else
    echo "usage: $0 { start | stop }"
    exit
fi
Posted
Filed under 01010101
$ sudo vi /etc/nginx/sites-enabled/domain.conf

server {
    server_name domain;

    root /home/ubuntu/domain;
    index index.php;

    # set expiration of assets to MAX for caching
    location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
        access_log off;
        log_not_found off;
        expires 360d;
    }

    # static contents
    if ($request_uri ~* ^/(images|css|js|font)/) {
        rewrite ^(.*$) /www/$1;
        break;
    }

    # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }

    location / {
        try_files $uri $uri/ /index.php;
    }

    location ~* \.php$ {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index   index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }

    # deny access to hidden files
    location ~ /\. {
        access_log off;
        log_not_found off;
        deny all;
    }
}
Posted
Filed under 01010101
nginx setting

$ sudo vi /etc/nginx/site-avaliable/domain.conf

server {
    server_name domain;

    location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;

      proxy_pass http://127.0.0.1:8080/;
      proxy_redirect off;
    }
}
Posted
Filed under 01010101
NginX
sudo apt-get install nginx


MariaDB
$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
$ sudo add-apt-repository 'deb http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main'

$ sudo apt-get update
$ sudo apt-get install mariadb-server

$ sudo mysql_secure_installation


PHP
$ sudo apt-get install php5 php5-cli php5-cgi php5-common php5-mysql php5-dev php5-mcrypt php5-curl php-pear php5-imagick php5-gd php5-fpm

XDebug
$ sudo apt-get install php5-xdebug
$ vi /etc/php5/fpm/conf.d/20-xdebug.ini
zend_extension=xdebug.so

xdebug.remote_enable=1
;xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_autostart=0

Xdebug 설정하기: http://dont.pe.kr/tc/292
nginx + php-fpm 에서 xdebug 동작 안하는 문제: http://dont.pe.kr/tc/404


node.js
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs


git
$ sudo apt-get install git

ImageMagick
$ sudo apt-get install imagemagick

Posted
Filed under 01010101

RESTful API 구현

어떤 언어를 사용할까?

선택지는 Java+Spring, PHP+CodeIgniger, JavaScript+node.js
ruby, python 은 언어 경험이 없기 때문에 선택지에서 제외
가장 최근까지 PHP+CodeIgniter 로 Web + RESTful API 개발
PHP+CodeIgniter+MariaDB 로 Web 개발 결정
node.js 가 얼마나 좋은가? 라는 호기심에 JavaScript+node.js 선택

Express 와 restify 중에서 어떤 모듈을 이용할까?

웹사이트는 PHP+CodeIgniger 로 개발하기 때문에, 단지, API 기능만 개발하면 되는 상황.
restify 가 좀 더 목적에 맞는 모듈이라 생각되었기 때문에 restify 선택

MariaDB 이용

현재 사용중인 db 를 그대로 가져가야 함. 선택의 여지가 없음

MVC 구조

https://github.com/duddns/node-restify-mvc-mariasql