0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ec2(amazon linux)に古いバージョンのnginxを導入(デフォルトページの表示まで)

Posted at

仕事だと環境に合わせてバージョンを指定する事があるなと思い、
古いバージョンのnginxってどうやって入れるだっけと調べて試したのでメモ。

前提
 MACを使用
 EC2(amazon linux)インスタンスを立ち上げただけのものを使用
 セキュリティゾーンでsshとhttpを解放済み

ターミナルからsshでec2に入って下記コマンドを実行!

・お決まりのyumアップデート```
sudo yum -y update

・古いバージョンのRPMを取得```
sudo rpm -ivh  http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

・repoファイルの上書き?```
sudo sed -i -e "s/packages/centos/packages/mainline/centos/" /etc/yum.repos.d/nginx.repo

・インストールできるnginxの確認```
sudo yum --showduplicates --disablerepo=amzn-main list nginx

・バージョンを指定してインストール```
sudo yum install -y --disablerepo=amzn-main nginx-1.9.15

・nginxを起動(これでデフォルトページは表示されるはず。)```
sudo service nginx start

・自動起動設定```
sudo chkconfig nginx on


※「・インストールできるnginxの確認」では下記画像みたいに表示される
 画像は長いので表示の一部。インストール後に撮ったら色がついた。
![スクリーンショット 2018-07-11 9.52.05.png](https://qiita-image-store.s3.amazonaws.com/0/42969/84beee3c-938e-e047-36e9-eaad177e4816.png)

さて、これをDockerで作れるように頑張るかな。。。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?