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/bashrc
echo 'export PATH="${RBENV_ROOT}/bin:${PATH}"' >> /etc/bashrc
echo 'eval "$(rbenv init -)"' >> /etc/bashrc

# ruby-build
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
rbenv install -v 2.6.0
rbenv global 2.6.0
rbenv rehash
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/bashrc
echo 'export PATH="${NODENV_ROOT}/bin:${PATH}"' >> /etc/bashrc
echo 'eval "$(nodenv init -)"' >> /etc/bashrc

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

nginx

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

nginx config抜粋

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

server {
    listen       80;
    server_name  localhost;

    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;
    }
}

firewalldが動いていたら止める

systemctl status firewalld.service
systemctl stop firewalld.service