'Linux'에 해당되는 글 2건

  1. 2017.09.08 [Linux] Nginx unicorn rails 설정
  2. 2017.09.08 [Linux] Git Centos 설치 및 설정

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
이전버튼 1 이전버튼

블로그 이미지
kkangMH

공지사항

Yesterday
Today
Total

달력

 « |  » 2024.5
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 29 30 31

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함