[AWS,EC2] NginxのInstall
概要
NginxをInstallして、Browserでアクセスしてみます。
その前に初期設定はこちらにメモしました。
https://qiita.com/masanos/items/a195f95bd526d619d95d
NginxのInstall
基本的には下記でInstallからServer Startまでができる。
$ sudo yum update $ sudo yum install nginx $ sudo service nginx start $ sudo nginx -s stop
参考までに
$ nginx -v ※Versionの確認 nginx version: nginx/1.12.1 $ sudo chkconfig nginx on ※自動起動設定 $ which nginx ※pathが通っているか /usr/sbin/nginx $ sudo nginx -t ※設定Fileのcheck nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful $ ps aux | grep nginx ※起動していない時 ec2-user 32107 0.0 0.2 110484 2152 pts/0 S+ 12:26 0:00 grep --color=auto nginx $ ps aux | grep nginx ※起動している時 root 32129 0.0 0.1 59144 1052 ? Ss 12:27 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nginx 32131 0.0 0.3 59592 3884 ? S 12:27 0:00 nginx: worker process ec2-user 32133 0.0 0.2 110484 2144 pts/0 S+ 12:27 0:00 grep --color=auto nginx
Nginxを起動していbrowserからアクセスする
より、
パブリック DNS (IPv4)
IPv4 パブリック IP
に記載のあるhost(IP)にアクセスして、下記が出れば成功です。