This is a note when Rails was installed on CentOS7.
The final Nginx nginx.conf file can be found here.
$ ssh root@IP_ADRESS
$ yum update
$ adduser kabigon
$ passwd kabigon
# enter password
$ exit
$ ssh kabigon@IP_ADRESS
$ su -
$ cd /etc/ssh
$ cp sshd_config sshd_config.old
$ vim sshd_config
PermitRootLogin yes -> PermitRootLogin no
$ systemctl restart sshd.service
$ exit
$ ssh root@IP_ADRESS
# can not login
$ yum -y install openssl-devel readline-devel zlib-devel libcurl-devel make openssl-devel
$ yum -y install gcc-c++ glibc-headers openssl-devel readline libyaml-devel readline-devel zlib
$ yum -y install git gcc make openssl-devel libffi-devel sqlite sqlite-devel nodejs
$ cd /opt
$ git clone https://github.com/rbenv/rbenv.git
$ mkdir /opt/rbenv/plugins
$ cd /opt/rbenv/plugins
$ git clone https://github.com/rbenv/ruby-build.git
$ cat << 'EOS' > /etc/profile.d/rbenv.sh
export RBENV_ROOT="/opt/rbenv"
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
EOS
exec $SHELL -l
$ rbenv install 2.5.1
$ rbenv global 2.5.1
$ ruby -v
$ gem install rails
$ cd
$ rails new myApp
$ cd myApp
$ rails s
$ control + z
$ jobs
$ bg 1
$ curl localhost:3000
yum -y install nginx
systemctl enable nginx.service
systemctl start nginx.service
systemctl status nginx.service
$ firewall-cmd --add-service=http --permanent
$ firewall-cmd --reload
$ cd /etc/nginx
$ vi nginx.conf
listen 80;
listen [::]:80;
servername 0.0.0.0;
...
location / {
proxy_pass http://localhost:3000;
}
$ systemctl restart nginx.service