log

日記です

Install rbenv and nodenv

Amazon Linux2(CentOS7)

Rails5を動かすために。コマンドだけ貼っとく。

# 事前準備
yum -y install git
yum -y install gcc-c++ glibc-headers openssl-devel readline libyaml-devel readline-devel zlib zlib-devel libffi-devel libxml2 libxslt libxml2-devel libxslt-devel
yum -y install mysql mysql-devel

# rbenv install
git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
echo 'export RBENV_ROOT="/usr/local/rbenv"' >> /etc/profile
echo 'export PATH="${RBENV_ROOT}/bin:${PATH}"' >> /etc/profile
echo 'eval "$(rbenv init -)"' >> /etc/profile

# ruby-build
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
rbenv install -v 2.4.2
rbenv rehash
rbenv global 2.4.2
rbenv exec gem install bundler
rbenv rehash

# nodenv install
git clone git://github.com/nodenv/nodenv.git /usr/local/nodenv
echo 'export NODENV_ROOT="/usr/local/nodenv"' >> /etc/profile
echo 'export PATH="${NODENV_ROOT}/bin:${PATH}"' >> /etc/profile
echo 'eval "$(nodenv init -)"' >> /etc/profile

# node-build
git clone https://github.com/nodenv/node-build.git /usr/local/nodenv/plugins/node-build
nodenv install 9.5.0
nodenv rehash
nodenv global 9.5.0

nginx

sudo amazon-linux-extras install nginx1.12
sudo systemctl start nginx.service
sudo systemctl status nginx.service
sudo systemctl enable nginx.service

nginx config抜粋

http {
    upstream puma {
        server unix:///opt/xxx/shared/tmp/sockets/puma.sock;
    }

    server {
        listen       80;
        server_name  xxx.local;

        location / {
            proxy_read_timeout 300;
            proxy_connect_timeout 300;
            proxy_redirect off;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://puma;
        }
    }
}