Skip to content

Instantly share code, notes, and snippets.

@taisyo7333
Last active November 29, 2016 08:40
Show Gist options
  • Save taisyo7333/3a62ceca1340810ee68734bcb28ec007 to your computer and use it in GitHub Desktop.
Save taisyo7333/3a62ceca1340810ee68734bcb28ec007 to your computer and use it in GitHub Desktop.
WEBサーバー:CentOS7 + nginx

さくらインターネットでサーバーを作成 (CentOS7)

公開鍵を設定しておくと、ssh root@<ip_address>でログイン可

ssh-keygen
# 生成した公開鍵をサーバー作成時に設定しておく
cat ~/.ssh/id_rsa.pub


任意にユーザーを作成

ユーザー毎に公開鍵を転送した場合

リモート下記のファイルを用意しておく  ~/.ssh/authorized_keys

mkdir .ssh
chmod 0700 .ssh
touch .ssh/authorized_keys

転送

cat ~/.ssh/id_rsa.pub | ssh <ip_address> 'cat >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys'

nginx インストール & 起動

sudo rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum -y update nginx-release-centos
sudo yum -y --enablerepo=nginx install nginx
sudo yum -y install emacs
nginx -v
sudo systemctl enable nginx
sudo systemctl status nginx
getenforce  // SELinux の確認(Disablesudo iptables -F // iptablesリスト削除dになっているか)
sudo iptables -F // iptablesリスト削除
sudo iptables -L // 確認
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment