1. Rails install

 1. $ Gem install rails



2. Nginx 설치

 1. $ Yum install nginx



3. Rails gemfile에 unicorn 추가

 - 새로 생성한 rails 프로젝트 Gemfile에 gem 'unicorn' 추가 후 

 1. $ bundle install



4. Nginx 설정

 - /etc/nginx/conf.d/default.conf 

 upstream app{

server unix:/home/kang/tmp/test.unicorn.sock fail_timeout=0;

}

 

server {

    listen       3001;

    server_name 10.0.1.27;

    root /home/kang/test/server/test/public;

 

    location / {

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header Host $http_host;

        proxy_redirect off;

        proxy_pass http://app;

    }

 

    error_page   500 502 503 504  /50x.html;

 

}


 - /etc/nginx/nginx.conf

 user root;

worker_processes  1;

 

error_log  /var/log/nginx/error.log warn;

pid        /var/run/nginx.pid;

 

 

events {

    worker_connections  1024;

}

 

 

http {

    include       /etc/nginx/mime.types;

    default_type  application/octet-stream;

 

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request"

               '$status $body_bytes_sent "$http_referer" '

               '"$http_user_agent" "$http_x_forwarded_for"';

 

access_log  /var/log/nginx/access.log  main;

error_log /var/log/nginx/error.log;

sendfile        on;

#tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;

}



5. Unicorn 설정

 새로 생성한 프로젝트 config 폴더에서 unicorn.rb를 생성한다.

 /home/kang/test/server/test/config/unicorn.rb

Worker_processes 2

working_directory "/home/kang/test/server/test"


listen "/home/kang/tmp/test.unicorn.sock"


timeout 60


pid "/home/kang/test/server/test/tmp/pids/test.unicorn.pid" 


stderr_path "/home/kang/test/server/test/log/unicorn.stderr.log" 


stdout_path "/home/kang/test/server/test/log/unicorn.stdout.log"



6. 시작

 1. $ sudo service nginx start


 // 해당 프로젝트 경로로 들어간 후 

 2. $ Unicorn rails -c config/unicorn.rb -D


'Linux' 카테고리의 다른 글

[Linux] Git Centos 설치 및 설정  (0) 2017.09.08
Posted by kkangMH

Git을 사용하려면 설치를 해야 한다. Git은 다양한 방법으로 설치를 할 수 있지만 그 중에서 yum을 이용하여 설치를 진행하였다.


리눅스에 설치

 1. $ sudo yum install git-core



1. 설치가 완료후 Git을 위한 계정을 하나 추가한다.

 1. $ sudo adduser git

 2. $ sudo passwd git

 3. $ 패스워드 설정



2. Git 저장소가 위치할 공간 설정

 1. $ cd /opt                  // opt로 이동

 2. $ sudo mkdir git          // git 폴더를 생성

 3. $ sudo chown git.git git  // git 폴더의 소유자 변경

 4. $ cd git



3. 프로젝트 생성

 1. $ sudo git init --bare --shared project.git

 2. $ sudo chown -R git.git project.git



4. 로컬에서 만든 git저장소를 clone 하기

 1. $ cd ~

 2. $ git clone file:///opt/git/project.git



5. 외부 클라이언트에서 clone 하기

 - ssh를 이용하여 git clone

 - 만약 port에 내용이 없다면 ssh port 사용

 1. $ git clone ssh://git@[HOST]:[PORT]/opt/git/project.git



6. git add, commit, push

 1. $ git add test.txt

 2. $ git commit -m 'test add'

 3. $ git push origin master


'Linux' 카테고리의 다른 글

[Linux] Nginx unicorn rails 설정  (0) 2017.09.08
Posted by kkangMH

구글에서 제공해주는 API를 이용하면 안드로이드에서 지도를 만들기 간단합니다.


Google Map API를 연동하는 방법을 정리합니다. 안드로이드 스튜디오를 이용하여 진행하였습니다.


1. 안드로이드 스튜디오에서 새로운 프로젝트 생성

  원하는 프로젝트 이름으로 안드로이드 프로젝트를 생성합니다.

 


2. Google 프로젝트 만들기

 https://console.cloud.google.com 로 이동하여 프로젝트를 생성할 수 있습니다.

 - 원하는 프로젝트 이름을 설정하여 프로젝트를 생성하세요.



3. Google Map Api 사용 설정하기





4. 안드로이드에서 사용할 Google API 키 생성하기





 - 여기서 android 앱의 사용량 제한 항목에서 패키지 이름 및 지문을 추가는 선택사항입니다.

   추가를 원하는 분들을 위해서 SHA-1 인증서 지문 받는 방법입니다.

1. cmd를 실행합니다.

2. C:\Users\%username%\.android     // 경로로 이동합니다.

3. keytool -list -keystore debug.keystore -keypass android -storepass android -alias androiddebugkey                             // 명령어를 입력하면 SHA-1 인증서 지문을 가져올 수 있습니다.

4. 가져온 인증서 지문을 사용하면 됩니다.



5. 안드로이드 프로젝트(build.gradle 추가)



6. 구글 키 등록하기 (strings.xml 파일)



7. manifests 파일

 - 구글맵을 사용할 때 필요한 권한을 추가 및 meta-data 추가



8. MainActivity.java

 - 초기 위치를 위도 경도를 이용하여 설정 하고 내위치로 가는 버튼을 사용설정, 초기 줌 레벨을 15로 설정



9. activity_main.xml

 - google map을 추가하기위한 fragment를 추가합니다.



10. CustomMapFragment.java

 - Google Map Fragment를 사용할 때 원하는 방식으로 custom 하기 위해서 추가

 - fragment touch 이벤트 부분




Posted by kkangMH
이전버튼 1 2 3 4 5 6 이전버튼

블로그 이미지
kkangMH

공지사항

Yesterday
Today
Total

달력

 « |  » 2025.2
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함